From: "Andy Lord" <[EMAIL PROTECTED]> > [Apologies if this appears twice - my email system has me under a few aliases > and the post > one ended up awaiting moderation - but I'm in a real hurry!!] > > Hi guys - before I prepare an example I wonder if anyone knows what > I'm doing wrong off the top off thier heads... > > I've got an XML file like this > > ----------------------------- > <?xml.....> > <myns:items xmlns:myns="http://myworld.com/mypage"> > > <myns:item myattribute="1"> > <myns:name>fred</myns:name> > </myns:item> > > <myns:item> > <myns:name>john</myns:name> > </myns:item> > > </myns:items> > ------------------------------ > > I'm using JDOM & Jaxen (latest downloads but I had the same problem with > prior downloads) > > When I use Jaxen to get a nodelist using "//myns:item" it returns 2 nodes > ok > When I use "//myns:item[@myattribute='1']" I get 1 node (fred) OK > When I use "//myns:item[not(@myattribute)]" I get 1 node (john) OK > > So far so good .. (I'm setting the NameSpace context correctly on the > java XPATH object and the URIs are the same as in the XML file otherwise > the above examples wouldn't have worked I guess) > > BUT when I try anything Xpath like > > "//myns:item[mysn:name='fred']" > > OR > > "//myns:item[contains(mysn:name,'fred')]" > > OR even > > "//myns:item[contains(text(mysn:name),'fred')]" > > > etc it seems to fail hopelessly.
When you say fails hopelessly do you mean returns nothing? > I can provide an example but that more > or less sums it all up. Either I'm doing something really wrong (and I've > spent hours looking at it) or Jaxen doesnt like namespacey stuff inside > '[...]'. Which I doubt... > > > Any one got any clues ??? Does /myns:item/mysn:name find anything? Try evaluating something like /myns:item/mysn:name/text() to see what the text looks like. There might be some wierd JDOM text node whitespace or text splitting stuff going on or something. James ------- http://radio.weblogs.com/0112098/ __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com ------------------------------------------------------- This sf.net email is sponsored by: Influence the future of Java(TM) technology. Join the Java Community Process(SM) (JCP(SM)) program now. http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en _______________________________________________ Jaxen-interest mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jaxen-interest