I have been trying with no result, to force Xerces parsers to ignore
whitespace in my XML file. I have tried several of the NG suggested
setFeature() methods in DOMParser to no avail.
I have now started to use the newest version of Xerces and as a result
I stopped using DOMParser. The following fragment of my code shows how
I create the parser and parse my XML file, which still has <null>
#text fields for whitespace. How can I force Xerces to ignore them?
Thanks,
John
Java Code:
=======
public class XMLConvert {
private DocumentBuilder Factory builderFactory;
private DocumentBuilder docFactory;
private Document inDoc;
public static void main(String[] args)
{
XMLConvert xml = null;
try {
xml = new XMLConvert(new FileInputStream (new File(args[0])));
} catch(Exception e) {
e.printStackTra ce();
}
}
public XMLConvert(Inpu tStream is)
{
try {
builderFactory = DocumentBuilder Factory.newInst ance();
docFactory = builderFactory. newDocumentBuil der();
inDoc = docFactory.pars e(is);
} catch(Exception e) {
e.printStackTra ce();
}
}
My simple XML file:
============
<?xml version="1.0" encoding="UTF-8"?>
<Envelope>
<Body>
Test
</Body>
</Envelope>
Output from Java (children of root element):
=============== =============
Node Name: #text
Local Name: null
URI: null
Node Name: Body
Local Name: null
URI: null
Node Name: #text
Local Name: null
URI: null
Comment