[Home] [By Thread] [By Date] [Recent Entries]
HI:
I have the following code that parses an input file into an xml
doc.This input file has namespace associated with it.
XMLDocument xmlDocument = null;
DOMParser parser = new DOMParser();
parser.setValidationMode(XMLConstants.NONVALIDATING);
parser.parse(in_xml_url); //input file
xmlDocument = parser.getDocument();
LocalNSResolver lnsr = new LocalNSResolver();
lnsr.addNamespacePrefix("ns", "http://www.oracle.com/discoverer/configuration");
NodeList nodeList=xmlDocument.selectNodes("/ns:applet/transport", lnsr);
I want to feed an input file having no namespace or prefix to this
code, is there a method or something available on the xmlDocument
object that can give this information.
If Doc has NS and Prefix then
{
add namespace
select nodes from namespace
}
else
{
do not add namespace
}
Thanks.
|

Cart



