Hi,
my guess is that your DTD defines default values for these attributes. dom4j doesn't provide support yet to ignore these attribute values when writing the XML.
At the moment, the only solution is to remove these default values from your DTD.
regards,
Maarten
Hong Qian <[EMAIL PROTECTED]> wrote:
Hong Qian <[EMAIL PROTECTED]> wrote:
I would like to print a clean XML. Here are my source code. Build a DOM
object first, then print it out. My problem is the print result contains DTD
kind of information, such as "dt_type".
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:ON M5E1L5
result:dt_pattern="[\000-\177]*">ON M5E1L5
-------------------------------------------------------
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
Do you Yahoo!?
The all-new My Yahoo! – What will yours do?