|
From: Fernando G. <fer...@gm...> - 2007-03-28 08:47:05
|
Thanks a lot for your help Jimmy. I cannot test right now the proposed
solution, but I will do it this week. If it's just that, I'm sorry to have
wasted your time...
Fernando
On 3/28/07, Jimmy Zhang <cra...@co...> wrote:
>
> It seems that "ap.declareXPathNameSpace("cite", "
> www.opengeospatial.net/cite");" should
> have been "ap.declareXPathNameSpace("cite", "*http://*
> www.opengeospatial.net/cite");"
>
> also ap.selectElementNS is not for XPath eval/selection, it is to emulate
> DOM's
> noteIterator inteface.
>
> Let me know if there is any question...
>
> ----- Original Message -----
> *From:* Fernando Gonzalez <fer...@gm...>
> *To:* vtd...@li...
> *Sent:* Tuesday, March 27, 2007 1:55 AM
> *Subject:* [Vtd-xml-users] XPath doubt
>
> Hi again,
>
> I'm having some problems using XPath expressions...
> When I use the "/wfs:FeatureCollection/gml:featureMember" expression it
> works fine.
> But if I add one more element:
> "/wfs:FeatureCollection/gml:featureMember/cite:Streams" it matches
> nothing...
> The most surprising (to me) is that if I use this
> "/wfs:FeatureCollection/gml:featureMember/*" it matches the "cite:Streams"
> elements in the XML.
>
> Am I missing something??
>
> By the way, I don't know what's the point of the "
> AutoPilot.selectElementNS" and "AutoPilot.declareXPathNameSpace" methods
> so maybe the problem is there. Where can I find some documentation about
> them. I looked in the javadoc but it's not clear to me.
>
> Thanks in advance,
>
> This is the code and the file:
>
> AutoPilot ap = new AutoPilot(vn);
> ap.selectElementNS("www.opengeospatial.net/cite ", "*");
> ap.declareXPathNameSpace("cite", "www.opengeospatial.net/cite");
> ap.selectElementNS(" http://www.opengis.net/gml", "*");
> ap.declareXPathNameSpace("gml", "http://www.opengis.net/gml");
> ap.selectElementNS(" http://www.opengis.net/wfs", "*");
> ap.declareXPathNameSpace("wfs", "http://www.opengis.net/wfs");
> ap.selectXPath
> ("/wfs:FeatureCollection/gml:featureMember/cite:Streams");
> int result = -1;
> while ((result = ap.evalXPath()) != -1) {
> long l = vn.getElementFragment ();
> int tokenOffset = (int) (0x0000FFFF & l);
> int tokenLength = (int) ((0xFFFF0000 & l) >> 32);
>
> System.out.println(new String(b, tokenOffset, tokenLength));
> }
>
>
> I have the following XML file:
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs " xmlns:gml="
> http://www.opengis.net/gml" xmlns:cite="http://www.opengeospatial.net/cite"
> xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.opengeospatial.net/cite
> http://www.refractions.net:8082/geoserver1.3.1/wfs/DescribeFeatureType?typeName=cite:Streams
> http://www.opengis.net/wfs
> http://www.refractions.net:8082/geoserver1.3.1/schemas/wfs/1.0.0/WFS-basic.xsd
> ">
> <gml:boundedBy>
> <gml:Box>
> <gml:coordinates decimal="." cs="," ts=" ">- 0.0004,-0.0024 0.0036,
> 0.0024</gml:coordinates>
> </gml:Box>
> </gml:boundedBy>
> <gml:featureMember>
> <cite:Streams fid="Streams.1">
> <cite:the_geom>
> <gml:MultiLineString>
> ...
>
>
> ------------------------------
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
> ------------------------------
>
> _______________________________________________
> Vtd-xml-users mailing list
> Vtd...@li...
> https://lists.sourceforge.net/lists/listinfo/vtd-xml-users
>
>
|