How could I avoid to print out such kind of information?
Thank you,
Jimmy
SAXReader xmlReader = new SAXReader(); xmlReader.setValidation(false); xmlReader.setIncludeInternalDTDDeclarations(false); xmlReader.setStripWhitespaceText(true); xmlReader.setIgnoreComments(true); xmlReader.setMergeAdjacentText(false);
xmlMessage.trim(); //c = DocumentHelper.parseText(xmlMessage); StringReader sr = new StringReader(xmlMessage); doc = xmlReader.read(sr);
OutputFormat format = OutputFormat.createPrettyPrint(); format.setSuppressDeclaration(true);
XMLWriter writer = new XMLWriter(format); writer.write(doc);
input xml string: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE AUTO SYSTEM "AUTODraftV1_14.dtd"> <root> <StateProvCd>ON</StateProvCd> <PostalCode>M5E1L5</PostalCode> <HomePhone/> </root>
result:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE AUTO SYSTEM "AUTODraftV1_14.dtd">
<root>
<StateProvCd dt_type="string" dt_maxLength="80" dt_pattern="[\000-\177]*">ON</StateProvCd>
<PostalCode dt_type="string" dt_maxLength="11">M5E1L5</PostalCode>
<HomePhone dt_type="string" dt_maxLength="32"/>
</root>
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user