Article complet: Preserving lexical information when modifying an XML document
19.11.06
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.