Bugs item #1214167, was opened at 2005-06-03 10:53 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=116035&aid=1214167&group_id=16035
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Michael (milut) Assigned to: Nobody/Anonymous (nobody) Summary: XPath with unqualified root element works wrong. Initial Comment: Wrong evaluating result of XPath expression with unqualified root element on document with qualified root element. I have the following xml document: <?xml version="1.0" encoding="UTF-8"?> <uri1:rootElement xmlns:uri1="uri1" xmlns:uri1a="uri1" xmlns:uri2="uri2"> text of rootElement </uri1:rootElement> And the following code fragment: Document document = DocumentHelper.parseText("<? xml version=\1.0\ encoding=\UTF-8\? ><uri1:rootElement xmlns:uri1=\uri1\ xmlns:uri1a=\uri1\ xmlns:uri2=\uri2\>text of rootElement</uri1:rootElement>"); System.out.println("document: " + document.asXML() + "\n"); String xPathExpr = null; XPath xPath = null; Object selectedObject = null; xPathExpr = "rootElement"; xPath = DocumentHelper.createXPath(xPathExpr); selectedObject = xPath.selectSingleNode(document); System.out.println("test number 1: " + xPathExpr + " - selectedObject: " + selectedObject + "\n"); xPathExpr = "/rootElement"; xPath = DocumentHelper.createXPath(xPathExpr); selectedObject = xPath.selectSingleNode(document); System.out.println("test number 2: " + xPathExpr + " - selectedObject: " + selectedObject + "\n"); selectedObject in these two tests must be null because in the xml document the root element is qualified but in XPath expressions there are no namespace prefixes before root element. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=116035&aid=1214167&group_id=16035 ------------------------------------------------------- This SF.Net email is sponsored by Yahoo. Introducing Yahoo! Search Developer Network - Create apps using Yahoo! Search APIs Find out how you can build Yahoo! directly into your own Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005 _______________________________________________ dom4j-dev mailing list dom4j-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dom4j-dev