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

Philipp Berner mailinglist at berner-online.de
Thu Nov 13 05:40:50 PST 2003


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 at telia.com] 
Gesendet: Donnerstag, 13. November 2003 11:47
An: \'Philipp Berner\'; jdom-interest at jdom.org
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 at jdom.org 
> [mailto:jdom-interest-admin at jdom.org] För Philipp Berner
> Skickat: den 13 november 2003 09:39
> Till: jdom-interest at jdom.org
> Ä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 at yourhost.com






More information about the jdom-interest mailing list