Naveen,

JXPath 1.2 follows the XPath spec a little closer than JXPath 1.1. 
Specifically, with 1.2 you have to explicitly bind all namespaces, so
your code would have to be updated like this:

jxPathContext.registerNamespace("uc", "http://zvon.org/uppercase";);
jxPathContext.registerNamespace("lc", "http://zvon.org/lowercase";);

Iterator iterator = jxPathContext.iteratePointers("//lc:x111");

I hope this helps,

- Dmitri

--- Naveen <[EMAIL PROTECTED]> wrote:

> Hello,
> 
> to be more Clear here is the xml :
> 
> 
> <OOO xmlns="http://zvon.org/xnumber";
> xmlns:lower="http://zvon.org/lowercase"; ooo="222">
> <aaa xmlns:lower="http://zvon.org/uppercase";>
>       <lower:BBB xmlns:lower="http://zvon.org/ws";>
>       <lower:x111 a="1"/>
>       <sss xmlns:lower="http://zvon.org/xnumber";>
>                               <lower:x111 a="2"/>
>       </sss>
>       </lower:BBB>
>       <lower:x111 a="3"/>
>       </aaa>
>       <aaa xmlns="http://zvon.org/uppercase";>
>       <BBB xmlns:upper="http://zvon.org/uppercase"; U="A"
> lower:U="A" upper:U="A"/>
>       </aaa>
>       <aaa xmlns="http://zvon.org/lowercase";>
>       <upper:BBB xmlns="http://zvon.org/xnumber";
> xmlns:upper="http://zvon.org/uppercase";>
>                       <x111 a="5"/>
>               </upper:BBB>
>               <Tmp xmlns="http://zvon.org/uppercase";>
>                       <x111 a="6"/>
>               </Tmp>
>       </aaa>
> </OOO>
> 
> 
> and this is the code i use . 
> 
> 
>  InputStream inputStream = new
> ByteArrayInputStream(xmlString.getBytes());
>       DocumentBuilderFactory dbf =
> DocumentBuilderFactory.newInstance();
> DocumentBuilder parser = dbf.newDocumentBuilder();
> Document document = parser.parse(new
> InputSource(inputStream));
> JXPathContext jxPathContext =
> JXPathContext.newContext(document.getDocumentElement());
> jxPathContext.setLenient(false);
> Iterator iterator =
> jxPathContext.iteratePointers("//x111");
> while(iterator.hasNext())
> {
>    System.out.println(iterator.next());
> }
> 
> 
> Hope Iam not confusing you guys.
> 
> Thanks a lot,
> Naveen.
> 
> 
> --- Naveen <[EMAIL PROTECTED]> wrote:
> 
> > Hello all,
> > 
> > my question may be little weired. Iam have some
> > problem when i upgraded to jxpath1.2 from jxpath1.1.
> > 
> > Iam attaching the sample code below.
> > 
> > When i use jxpath1.1 with jdk1.3 and wl6.1 i get the
> > output.
> > But when i use jxpath1.2 with jdk1.3 and wl6.1 there
> > is no output.
> > 
> > Iam attaching the code below. 
> > 
> > Appreciate your response
> > 
> > 
> > Thanks,
> > Naveen.
> > --------------------------------------------------
> > 
> > public static void main(String[] args) throws
> > ParserConfigurationException, IOException,
> > SAXException
> >    {
> >       String xmlString = "<OOO
> > xmlns=\"http://zvon.org/xnumber\";
> > xmlns:lower=\"http://zvon.org/lowercase\";
> > ooo=\"222\">\n" +
> >                          "   <aaa
> > xmlns:lower=\"http://zvon.org/uppercase\";>\n" +
> >                          "      <lower:BBB
> > xmlns:lower=\"http://zvon.org/ws\";>\n" +
> >                          "         <lower:x111
> > a=\"1\"/>\n" +
> >                          "         <sss
> > xmlns:lower=\"http://zvon.org/xnumber\";>\n" +
> >                          "            <lower:x111
> > a=\"2\"/>\n" +
> >                          "         </sss>\n" +
> >                          "      </lower:BBB>\n" +
> >                          "      <lower:x111
> > a=\"3\"/>\n" +
> >                          "   </aaa>\n" +
> >                          "   <aaa
> > xmlns=\"http://zvon.org/uppercase\";>\n" +
> >                          "      <BBB
> > xmlns:upper=\"http://zvon.org/uppercase\"; U=\"A\"
> > lower:U=\"A\" upper:U=\"A\"/>\n" +
> >                          "   </aaa>\n" +
> >                          "   <aaa
> > xmlns=\"http://zvon.org/lowercase\";>\n" +
> >                          "      <upper:BBB
> > xmlns=\"http://zvon.org/xnumber\";
> > xmlns:upper=\"http://zvon.org/uppercase\";>\n" +
> >                          "         <x111
> > a=\"5\"/>\n"
> > +
> >                          "      </upper:BBB>\n" +
> >                          "      <Tmp
> > xmlns=\"http://zvon.org/uppercase\";>\n" +
> >                          "         <x111
> > a=\"6\"/>\n"
> > +
> >                          "      </Tmp>\n" +
> >                          "   </aaa>\n" +
> >                          "</OOO>";
> >       InputStream inputStream = new
> > ByteArrayInputStream(xmlString.getBytes());
> >       DocumentBuilderFactory dbf =
> > DocumentBuilderFactory.newInstance();
> >       DocumentBuilder parser =
> > dbf.newDocumentBuilder();
> >       Document document = parser.parse(new
> > InputSource(inputStream));
> >       JXPathContext jxPathContext =
> >
> JXPathContext.newContext(document.getDocumentElement());
> >       jxPathContext.setLenient(false);
> >       Iterator iterator =
> > jxPathContext.iteratePointers("//x111");
> >       while(iterator.hasNext())
> >       {
> >          System.out.println(iterator.next());
> >       }
> >    }
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> > protection around 
> > http://mail.yahoo.com 
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to