Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

SV: [jdom-interest] problem with a slash in xpath dir

Per Norrman

2003-11-13

Replies:


But what is the actual exception? How
do you know it is the XPath.selectSingleNode(..) that fails?

/pmn


> -----Ursprungligt meddelande-----
> Från: jdom-interest-admin@(protected)
> [mailto:jdom-interest-admin@(protected)
> Skickat: den 13 november 2003 14:41
> Till: jdom-interest@(protected)
> Ämne: AW: [jdom-interest] problem with a slash in xpath dir
>
>
> Hi,
> I\'m also using JDOM b-9.
>
> The Xpath path work under a tool called \"xmlspy\". But it
> don\'t work with JDOMs Xpath. I\'m using Sun Java 1.3.
>
> The jaxen version is 1.10.
>
> The source:
>
>
> xpathString = \"/AAB/germany[node()=\\\'munich/berlin\\\']\";
> try
> {
> /*copy the element from new doc to result doc.*/
>
>  Element copy =
> (Element)XPath.selectSingleNode(newDocument,xpathString);
>  Element target =
> (Element)XPath.selectSingleNode(resultDocument, xpathTargetString);
>  copy = (Element)copy.clone();
>  
>  ...
> }
> catch (JDOMException e)
> {
>  System.out.println(\"error: XPath failed to select
> Node. Node: \" + xpathString);
>  System.exit(1);
> }
>
> The XML file looks like:
> <AAB>
>  <germany>augsbug</germany>
>  <germany>munich/berlin></germany>
> </AAB>
>
> Philipp
>
> -----Ursprüngliche Nachricht-----
> Von: Per Norrman [mailto:pernorrman@(protected)]
> Gesendet: Donnerstag, 13. November 2003 11:47
> An: \'Philipp Berner\'; jdom-interest@(protected)
> Betreff: SV: [jdom-interest] problem with a slash in xpath dir
>
> Hi,
>
> this works for me using JDOM b-9 and the supporting
> jaxen-* libraries. Can you provide more details?
>
> /pmn
>
> > -----Ursprungligt meddelande-----
> > Från: jdom-interest-admin@(protected)
> > [mailto:jdom-interest-admin@(protected)
> > Skickat: den 13 november 2003 09:39
> > Till: jdom-interest@(protected)
> > Ämne: [jdom-interest] problem with a slash in xpath dir
> >
> >
> > Hello,
> > I have a problem with xpath path.
> > I can’t get a node with xpath from a jdom document, when
> > there is a slash in the node text. For example:
> >
> >
> > error: XPath failed to select Node. Node:
> > /AAB/germany[node()=\\\'munich/berlin\\\']
> >
> >
> > The problem is the slash between \\\"munich/berlin\\\".
> >
> > Does someone have a idea, how i can fix this problem?
> >
> > Thanks a lot.
> >
> > Philipp
> >
> >
> >
> > _______________________________________________
> > To control your jdom-interest membership:
> > http://lists.denveronline.net/mailman/options/jdom-interest/yo
> uraddr@(protected)
>
>
>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/yo
uraddr@(protected)

_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@(protected)


©2008 junlu.com - Jax Systems, LLC, U.S.A.