commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Naveen <nawee...@yahoo.com>
Subject [JXPath] different output for 1.1 & 1.2
Date Wed, 20 Jul 2005 14:56:02 GMT
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 

---------------------------------------------------------------------
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