OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Find out whether a document has namespace defined

[ Lists Home | Date Index | Thread Index ]
  • To: xml-dev@lists.xml.org
  • Subject: Find out whether a document has namespace defined
  • From: Nishi Prafull <nishiprafull@gmail.com>
  • Date: Fri, 28 Jan 2005 12:29:04 -0800
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; b=QkWl97UUYoMBhEHAnJ4n8AlAmzzOlfbW3KpEAd0ASiD0th53XgmGw9gNuKqcnEqnnV9HbyNP9pDEKeQgdoiF/qJ5IXsjGcBX5lMMtNjxnJCV9lLBhz2r9ZITbxpf8NQpNcZYFplQdr7yq7AGQKhuvsrZ0Ka8tCG+nBYmn5MeAaI=
  • Reply-to: Nishi Prafull <nishiprafull@gmail.com>

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.




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS