commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitri Plotnikov <dmi...@apache.org>
Subject Re: JXPath: XMl traversal
Date Wed, 26 Mar 2003 13:09:36 GMT
Venkatesh,

Try passing to the JXPathContext the document itself, rather than its root
element.  I believe JXPath is trying to find a child of the root element
called "CONFIGURATION", but of course fails to find one.

I hope this helps.

- Dmitri Plotnikov

----- Original Message -----
From: "Venkatesh Prasad Ranganath" <vranganath@cox.net>
To: <commons-user@jakarta.apache.org>
Sent: Wednesday, March 26, 2003 8:04 AM
Subject: JXPath: XMl traversal


> Hi,
>
> The following snippet of code never dives into loop body for the
subsequent document.  Can somebody tell me what might I be
> doing wrong?
>
> <doc is a Document object obtained from jaxp parser>
> Element root = doc.getDocumentElement();
> JXPathContext ctxt = JXPathContext.newContext(root);
> for(Iterator i = ctxt.iterate("CONFIGURATION/PROCESSOR"); i.hasNext();) {
> System.out.println("1");
> processProcessor((Element) i.next());
> }
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!-- DOCTYPE CONFIGURATION SYSTEM "MC__1_1BasicSP.dtd"-->
> <!DOCTYPE CONFIGURATION SYSTEM "OEP_Configuration_2_2.dtd">
> <CONFIGURATION>
>      <PROCESSOR>
>          <NAME> PROCESSOR1 </NAME>
>      </PROCESSOR>
> </CONFIGURATION>
>
> waiting for reply,
> --
>
> Venkatesh Prasad Ranganath,
> Dept. Computing and Information Science,
> Kansas State University, US.
> web: http://www.cis.ksu.edu/~rvprasad
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>


Mime
View raw message