← Prev in month ← Prev in thread
Next in thread → Next in month →

Find out whether a document has namespace defined

From
Nishi Prafull <>
To
Date
2005-01-28T20:29:04Z
ID
<>
Thread
Find out whether a document has namespace defined
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.
← Prev in month ← Prev in thread
Next in thread → Next in month →