You likely sent this message to the wrong apache discussion group.

If you do find the right group, you probably should include a sample XML
document being loaded as well.

Mike 

> -----Original Message-----
> From: Bce Bce [mailto:[email protected]] 
> Sent: Tuesday, December 23, 2008 6:49 AM
> To: [email protected]
> Subject: using xpath in DOM
> 
> Hi,
>  
> I am trying to  get the list of elements using xpath. The 
> below code is returning 0
>  
> DOMParser parser = new DOMParser();
> Document doc = parser.parse("D:/util/compare/util.xml");
> NodeList gvNodeList = XPathAPI.selectNodeList(doc, 
> "//address/name"); 
> System.out.println("------lenth-------->"+gvNodeList.getLength());
>  
>  
> But the below code works fine, returning 3
>  
> 
> javax.xml.parsers.DocumentBuilderFactory df = 
> javax.xml.parsers.DocumentBuilderFactory.newInstance();
> df.setValidating(false);
> Document xml_schema = 
> df.newDocumentBuilder().parse("D:/util/compare/util.xml");
> NodeList xml_tables = 
> XPathAPI.selectNodeList(xml_schema,"//application");
> System.out.println("------lenth-------->"+xml_tables.getLength());
> 
>  
> The only difference is I am parsing the xml using 
> DocumentBuilderFactory 
>  
> Can anyonetell me whats wrong with my previous code
>  
> Thanks in advance,
> bce
>  
>  
>  
> 
> ________________________________
> 
> New Email names for you! 
> <http://sg.rd.yahoo.com/sg/mail/domainchoice/mail/signature/*h
ttp://mail.promotions.yahoo.com/newdomains/sg/>
> Get the Email name you've always wanted on the new @ymail and 
> @rocketmail.
> Hurry before someone else does!
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to