Article complet: Preserving lexical information when modifying an XML document

19.11.06

Permalink Categories: XML, Java   English (EU)

Preserving lexical information when modifying an XML document

When modifying an existing document, the easiest solution is to load it from storage (DOM, SAX or STaX), modify it and write it back to storage, but that process destroys original XML layout, comments, white spaces, etc ...

SAX2's property http://xml.org/sax/properties/lexical-handler allows to catch lexical events such as whitespaces. It might allow to preserve lexical information when writing back a modified XML document.

Code:

// Set the lexical handler 
saxParser.setProperty("http://xml.org/sax/properties/lexical-handler", 
lexicalInformationPreserverHandler); 

I'll have to try that when I find the time ;)

Trackback address for this post:

http://www.vidal.biz/blogs/htsrv/trackback.php/925

Comments, Trackbacks, Pingbacks:

No Comments/Trackbacks/Pingbacks for this post yet...

Comments are not allowed from anonymous visitors.

DraK's Klog

Février 2012
Lun Mar Mer Jeu Ven Sam Dim
<< <     
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29        

Rechercher

Catégories

Linkblog

Friends

Other

Syndiquez ce blog XML

Qu'est-ce que RSS?

powered by
b2evolution