Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Document with whitspace

843834Oct 10 2002 — edited Oct 10 2002
I am trying to use the JAXP 1.2 parser to create a Document with no whitespace Nodes, but when I do the following the document is filled with Whitespace Nodes. How can I get rid of them?

DocumentBuilderFactory domFactory
= DocumentBuilderFactory.newInstance();
domFactory.setNamespaceAware(true);
domFactory.setValidating(true);
domFactory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
domFactory.setAttribute(
"http://apache.org/xml/features/dom/include-ignorable-whitespace",
new Boolean(false));
domFactory.setIgnoringComments(true);
domFactory.setIgnoringElementContentWhitespace(true);
builder = domFactory.newDocumentBuilder();
Document doc = builder.parse(xml);
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 7 2002
Added on Oct 10 2002
2 comments
92 views