You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "gareth reakes (Closed) (JIRA)" <xa...@xml.apache.org> on 2012/02/08 13:19:59 UTC

[jira] [Closed] (XALANJ-2549) XPath with default namespace - No result

     [ https://issues.apache.org/jira/browse/XALANJ-2549?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

gareth reakes closed XALANJ-2549.
---------------------------------

    Resolution: Not A Problem

Query rather than bug
                
> XPath with default namespace - No result
> ----------------------------------------
>
>                 Key: XALANJ-2549
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2549
>             Project: XalanJ2
>          Issue Type: Bug
>      Security Level: No security risk; visible to anyone(Ordinary problems in Xalan projects.  Anybody can view the issue.) 
>          Components: Xalan
>    Affects Versions: 2.7.1
>            Reporter: Olivier Roger
>              Labels: xalan, xpath
>
> Hi,
>  
> I am having difficulties to use XPath query on a XML dataset having its root element with an *xmlns attribute with no prefix*.
>  
> In that specific case, the XPath query does not return the value. Since I have no prefix for the namespace I simply can get the value.
> It this a known issue or am I simply doing something wrong ?
> Here is my XML :
> {noformat:title=default-ns.xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <report xmlns="http://www.mydomain.com/report">
>     <account_number>123</account_number>
> </report>
> {noformat}
> {code}
>     @Test
>     public void xPathDefaultNS() throws XPathExpressionException {
>         javax.xml.xpath.XPathFactory factory = javax.xml.xpath.XPathFactory.newInstance();
>         javax.xml.xpath.XPath xpath = factory.newXPath();
>         javax.xml.xpath.XPathExpression expression = xpath.compile("/report/account_number");
>         String result = expression.evaluate(new org.xml.sax.InputSource(this.getClass().getResourceAsStream("default-ns.xml")));
>         Assert.assertTrue("123".equals(result));
>     }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org