Hi All,
Iam tring to get the values of an XML using the following code.
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
domFactory.setIgnoringElementContentWhitespace(true); System.out.println(domFactory.isIgnoringElementContentWhitespace());
domFactory.setNamespaceAware(true); // never forget this!
DocumentBuilder builder = domFactory.newDocumentBuilder();
Document
doc = builder.parse("samplexml.xml");
When i was trying to print the Node Names under FistElement,I get
true
#text
ChildElement1
#text
ChildElement2
#text The following is the XML Content....
<Elements>
<FirstElement>
<ChildElement1>shf</ChildElement1>
<ChildElement2>zxcv</ChildElement2>
<FirstElement>
</Elements>
But when i execute the same code with the above xml defined in the same line,then iam getting (CORRECTLY)
ChildElement1
ChildElement2 can anyone provide me a solution to ignore the White Spaces in the XML???
Thanks in advance
Senthil