1.

Why Does The Xml Data Generated By The Domlsserializer Does Not Match My Original Xml Input?

Answer»

If you parse an xml document using XercesDOMParser or DOMLSParser and pass such DOMNode to DOMLSSerializer for SERIALIZATION, you may not get something that is exactly the same as the original XML data. The PARSER may have done normalization, end of line conversion, or has expanded the ENTITY reference as per the XML 1.0 specification, 4.4 XML Processor Treatment of ENTITIES and References. From DOMLSSerializer perspective, it does not KNOW what the original string was, all it sees is a processed DOMNode generated by the parser. But since the DOMLSSerializer is supposed to generate something that is parsable if sent back to the parser, it will not print the DOMNode node value as is. The DOMLSSerializer may do some "touch up" to the output data for it to be parsable.

If you parse an xml document using XercesDOMParser or DOMLSParser and pass such DOMNode to DOMLSSerializer for serialization, you may not get something that is exactly the same as the original XML data. The parser may have done normalization, end of line conversion, or has expanded the entity reference as per the XML 1.0 specification, 4.4 XML Processor Treatment of Entities and References. From DOMLSSerializer perspective, it does not know what the original string was, all it sees is a processed DOMNode generated by the parser. But since the DOMLSSerializer is supposed to generate something that is parsable if sent back to the parser, it will not print the DOMNode node value as is. The DOMLSSerializer may do some "touch up" to the output data for it to be parsable.



Discussion

No Comment Found