I am parsing an XML document into DOM. I end up with a DOM that contains
everything plus additional text nodes (type 3) containing just "\n".
XML :
<row>
<rows>1</rows>
<rows>2</rows>
</row>
After parsing this xml, the node <row> has next childs :
1.#text
2.<rows>
3.<#text>
4.<rows>
5.#text
I make validation with XSD. Validation is successfully. Also I add in XSD
attribute mixed="false". And whitespaces(node=#text) are also in the DOM
tree
How to parse without them?
Source :
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setIgnoringElementContentWhitespace(true);
factory.setNamespaceAware(true);
factory.setValidating(true);
factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
"http://www.w3.org/2001/XMLSchema");
factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource",
new
File("D:\\Projects\\RSA\\workspace_v2.0\\XML\\Query.xsd"));
DocumentBuilder builder = factory.newDocumentBuilder();
doc = builder.parse(new File("Query.xml"));
doc.normalize();
--
View this message in context:
http://www.nabble.com/Whitespace-problem-tf2276425.html#a6321927
Sent from the Xerces - J - Users forum at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]