Sure will. There is a chance it was something else I cleared up, but I will try it tonight.
I forgot about casting to Element and using the API. Good call. On the XPath, I thought that: //server was the same as server in XPath, ie. The // are not needed if they are at the beginning of a query. Jim Jim Brain, [EMAIL PROTECTED] "Researching tomorrow's decisions today." (319) 369-2070 (work) SYSTEMS ARCHITECT, INDIVIDUAL ITS, LIFE INVESTORS INSURANCE COMPANY OF AMERICA -----Original Message----- From: James Strachan [mailto:[EMAIL PROTECTED]] Sent: Sunday, November 11, 2001 3:07 AM To: Brain, Jim; DOM4J Mailing List (E-mail) Subject: Re: [dom4j-user] Issue with dom4j 1.1 Hi Jim I've added your test case to CVS. The xml document is in xml/test/jimBrain.xml and I've added a JUnit test case to demonstrate what I think you're trying to do at dom4j/src/test/org/dom4j/xpath/TestSelectSingleNode.java >From my testing it appears that dom4j 1.1 is working correctly for selectSingleNode using your XML document. Is there a chance you're doing something else differently? BTW you can find an Element and add a comment to it. e.g. Element server = (Element) document.selectSingleNode( "/properties/server" ); server.addComment( "this is a comment..." ); For example, could you modify the test case to try reproduce your problem? The test case is available in the daily build as well as via CVS... James ----- Original Message ----- From: "Brain, Jim" <[EMAIL PROTECTED]> To: "DOM4J Mailing List (E-mail)" <[EMAIL PROTECTED]> Sent: Friday, November 09, 2001 10:58 PM Subject: [dom4j-user] Issue with dom4j 1.1 > A couple actually: > > I had some XML like this: > > <?xml version="1.0"?> > <!-- THis is a comment --> > > <properties> > <client> > <threadsafe>false</threadsafe> > <GUI-type>simple</GUI-type> > </client> > <server id="jimmy">Server Stuff here > <db name="Jim"> > <connection> > <URL>http://www.digitalsymbiosis.net</URL> > <name>jdcasey</name> > <password>nothing</password> > </connection> > <connection> > <URL>http://www.digitalsymbiosis.net</URL> > <name>jdcasey</name> > <password>nothing</password> > </connection> > This is a test. This should be the server/db property... > Sure. > </db> > <connections> > <limit>5</limit> > <initial>1</initial> > </connections> > </server> > </properties> > > When I grab the Document and do > selectSingleNode("/properties/client/threadsafe"); I get an exception that > the item is not a node, I need to use getObject... Can someone tell me what > I am doing wrong? > > Also, is ther a way to add a comment to a Node? I see methods for > document.addComment, but not ode.addComment. Did I miss something? > > Finally, I can't seem to get relative XPath exp to work. In the above, > /properties/server gives Server Stuff here, but server or properties/server > (both in document.selectSingleNode() return null. > > Jim > > > Jim Brain, [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > "Researching tomorrow's decisions today." > (319) 369-2070 (work) > Systems Architect, Individual ITS, Life Investors Insurance Company of > America > > > _______________________________________________ > dom4j-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/dom4j-user > _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user
