My code parses an xml document and checks if nodes exist and contain text.
where appRoot = //Proposal/Applicant/
Then in the following block of code, 'doc' is a valid xml document.
For some reason though this always returns false, any help??
Code:
if(isPathNode(appRoot+"ExternalAddress/InternationalAddress/IntAddressLine"))
Then in the following block of code, 'doc' is a valid xml document.
Code:
private boolean isPathNode(String strPath) {
return(isXPathNode(doc,strPath));
}
private boolean isXPathNode(org.w3c.dom.Node objRoot,String strPath) {
try {
org.w3c.dom.Node objNode;
if(strPath.length()==0) {
return(false);
}
if((objNode=XPathAPI.selectSingleNode(objRoot,strPath))==null) {
return(false);
}
return(true);
} catch(Exception e) {
System.out.println("isXPathValue: "+e.toString());
return(false);
}
}
Comment