http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2772 *** shadow/2772 Tue Jul 24 13:35:26 2001 --- shadow/2772.tmp.23092 Tue Jul 24 13:35:26 2001 *************** *** 0 **** --- 1,51 ---- + +============================================================================+ + | XPath not locating nodes in default namespace | + +----------------------------------------------------------------------------+ + | Bug #: 2772 Product: XalanJ2 | + | Status: NEW Version: 2.2.x | + | Resolution: Platform: PC | + | Severity: Major OS/Version: Windows NT/2K | + | Priority: Other Component: org.apache.xpath | + +----------------------------------------------------------------------------+ + | Assigned To: [EMAIL PROTECTED] | + | Reported By: [EMAIL PROTECTED] | + | CC list: Cc: | + +----------------------------------------------------------------------------+ + | URL: | + +============================================================================+ + | DESCRIPTION | + I have encountered problems when I parse a document with namespaceAware set to + true and then try to use XPathAPI to locate nodes by name. The XPathAPI does + not find any nodes by name, but it does return results for generic + XPath expressions like '*' and '.'. + + All works well when I set namespaceAware to false in xerces. + + I am using Xalan-J 2-2-D6 and Xerces 1.4.2. + + Here's how I parse the document: + + DocumentBuilderFactory validatingDF = DocumentBuilderFactory.newInstance(); + validatingDF.setValidating(true); + validatingDF.setAttribute(XmlFeatures.SCHEMA_FULL_CHECKING, new Boolean(true)); + validatingDF.setNamespaceAware(true); + + final DocumentBuilder builder = factory.newDocumentBuilder(); + builder.setErrorHandler(new ErrorHandler()); + + Document document = build.parse(uri); + + XmlObject object = XPathAPI.eval(document, xpath); + + My sample XML document starts like this: + + <?xml version = "1.0" encoding = "UTF-8"?> + <yatra xmlns = "http://www.yatra.net" xmlns:xsi + = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation + = "http://www.yatra.net + file:///C:/work/yatra/web/xml/xsd/cognizer/cognizer.xsd"> + <ruleSet id = "airVAE"> + + When I submit 'yatra' as XPath query, nothing is found. + + However '.' returns the 'yatra' node.
