commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Ruess" <cru...@gmx.de>
Subject jxpath problem with jdom and setValue
Date Wed, 03 Mar 2004 09:35:12 GMT

 Hello - 
 I get an exception trying when calling setValue()  on JXPathContext from
 JDOM document.
 I reduced the problem in the example below and cited the exception.
 Is this a bug or am I doing something wrong?
 Please help / give a solution hint. 
 Thank you!
  Christian
 
 
 		Element root=new Element("root");                   // jdomv1.0-b10
 		Element subnode=new Element("subnode");
 		subnode.setText("1");
 		
 		root.addContent(subnode);
 		Document result=new Document();
 		result.setRootElement(root);
 		
 		JXPathContext jxpc=JXPathContext.newContext(result);  // JXPATH 1.1
 		System.out.println("getValJXPC:
 "+(String)jxpc.getValue("/root/subnode"));
 		try {
 			jxpc.setValue("/root/subnode","17");
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
 
 ->
 org.apache.commons.jxpath.JXPathException: Exception trying to set value
 with xp
 ath /root/subnode/.;
 org.jdom.Element.addContent(Lorg/jdom/Text;)Lorg/jdom/Element;
         at

org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.setValueJXPathContextReferenceImpl.java:385)
        at

org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.setValue(JXPathContextReferenceImpl.java:376)
 

-- 
+++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz +++
100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz


---------------------------------------------------------------------
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