[ https://issues.apache.org/jira/browse/CONFIGURATION-573?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13982077#comment-13982077 ]
Oliver Heger commented on CONFIGURATION-573: -------------------------------------------- First of all, sorry for the slow response. Support for XML namespaces is pretty limited currently, but I was not aware that it is completely broken when using {{XPathExpressionEngine}}. I will have a look what is going on. Thanks for the report. > The values of XML configuration keys having namespace prefix are null > --------------------------------------------------------------------- > > Key: CONFIGURATION-573 > URL: https://issues.apache.org/jira/browse/CONFIGURATION-573 > Project: Commons Configuration > Issue Type: Bug > Components: Expression engine > Affects Versions: 1.10 > Reporter: Petras > > Consider such snippet: > {code:java} > public void testElementWithNameSpace() throws Exception { > String xml = > "<Config>\n" + > "<dsig:Transforms > xmlns:dsig=\"http://www.w3.org/2000/09/xmldsig#\">\n" + > " <dsig:Transform > Algorithm=\"http://www.w3.org/TR/1999/REC-xpath-19991116\">\n" + > " <dsig:XPath xmlns:ietf=\"http://www.ietf.org\" > xmlns:pl=\"http://test.test\">self::pl:policy1</dsig:XPath>\n" + > " </dsig:Transform>\n" + > " <dsig:Transform > Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"/>\n" + > "</dsig:Transforms>" + > "</Config>"; > final XMLConfiguration config = new XMLConfiguration(); > config.setAttributeSplittingDisabled(true); > config.setDelimiterParsingDisabled(true); > config.setExpressionEngine(new XPathExpressionEngine()); > config.load(new StringReader(xml)); > System.out.println(ConfigurationUtils.toString(config)); > } > {code} > It prints all keys as null: > {code} > dsig:Transforms/dsig:Transform/dsig:XPath=null > dsig:Transforms/dsig:Transform/dsig:XPath/@xmlns:ietf=null > dsig:Transforms/dsig:Transform/dsig:XPath/@xmlns:pl=null > dsig:Transforms/dsig:Transform/@Algorithm=null > dsig:Transforms/@xmlns:dsig=null > {code} > Without XPathExpressionEngine set it prints correct values: > {code} > dsig:Transforms.dsig:Transform.dsig:XPath=self::pl:policy1 > dsig:Transforms.dsig:Transform.dsig:XPath[@xmlns:ietf]=http://www.ietf.org > dsig:Transforms.dsig:Transform.dsig:XPath[@xmlns:pl]=http://test.test > dsig:Transforms.dsig:Transform[@Algorithm]=[http://www.w3.org/TR/1999/REC-xpath-19991116, > http://www.w3.org/TR/2001/REC-xml-c14n-20010315] > dsig:Transforms[@xmlns:dsig]=http://www.w3.org/2000/09/xmldsig# > {code} > JXPath 1.3 version dependecy was used. > Am I missing something? -- This message was sent by Atlassian JIRA (v6.2#6252)