commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Naveen <nawee...@yahoo.com>
Subject Re: [JXPath] different output for 1.1 & 1.2
Date Wed, 20 Jul 2005 15:16:53 GMT
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 <naween18@yahoo.com> 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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message