Hi all,
I am experiencing something rather surprising ... If I execute the code
snippet herebelow, "startingNode" is set to null. However, if I comment the
three db.fsetAttribute() call, "startingNode" is set to the correct node ...
The funny thing is that the ouput of the dom (XMLTools.write()) is exactly
the same ...
Any help will be more than welcome,
Thanks in advance and best regards,
R�gis
private String NAMESPACES_FEATURE_ID =
"http://xml.org/sax/features/namespaces";
private String VALIDATION_FEATURE_ID =
"http://xml.org/sax/features/validation";
private String SCHEMA_VALIDATION_FEATURE_ID =
"http://apache.org/xml/features/validation/schema";
try
{
String path = "the path to my xml file" ;
DocumentBuilderFactory dbf =
DocumentBuilderFactory.newInstance() ;
dbf.setAttribute(SCHEMA_VALIDATION_FEATURE_ID, new
Boolean(true));
dbf.setAttribute(NAMESPACES_FEATURE_ID, new Boolean(true));
dbf.setAttribute(VALIDATION_FEATURE_ID, new Boolean(true));
DocumentBuilder domBuilder = dbf.newDocumentBuilder() ;
EdocErrorHandler errorHandler = new EdocErrorHandler() ;
domBuilder.setErrorHandler(errorHandler);
Document dom = domBuilder.parse(path) ;
Node startingNode =
XPathAPI.selectSingleNode(dom.getDocumentElement(), "metadata/DCMI/") ;
XMLTools.write(dom, System.out, "ISO-8859-1", true);
}
catch(Exception e)
{
e.printStackTrace();
}
snippet of the XML document :
<e-document version="0.1" xmlns="http://www.imtf.com/e-document"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.imtf.com/e-document edoc.xsd">
<metadata>
<DCMI>
<contributor>R�gis Piccand</contributor>
<etc.>
</DCMI>
</metadata>
</e-document>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]