Patch for xml-security-cpp XPath namespace resolving

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Patch for xml-security-cpp XPath namespace resolving

Yuri

Hi,

I've got a number of XAdES files to validate and have error with a significant number of them:

Xalan Exception : XPathParserException caught.  Message : The prefix 'ds' is not declared. expression = '/descendant::ds:Signature' Remaining tokens are:  ('/' 'descendant' '::')



XML looks like this:
<?xml version="1.0" encoding="UTF-8"?><toBeSigned>
toBeSigned
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="signature-9540-6631-2572-8805">
...
<dsig-xpath:XPath xmlns:dsig-xpath="http://www.w3.org/2002/06/xmldsig-filter2" Filter="subtract">/descendant::ds:Signature</dsig-xpath:XPath>
...


No error if "ds" namespace is declared in root element, or XPath element. But given files have "ds" in the middle. Given files are parsed normally with another library. So I made a small patch to walk through parent branches (from XPath element) and gather namespace attributes.

This patch is from my company's mercurial repo and is made against 1.7.3 release. Is it useful? Are you interested in it?

Best regards,
Yuri.

xml-security-cpp-xpath-resolving.patch (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Patch for xml-security-cpp XPath namespace resolving

Cantor, Scott
On 10/9/17, 6:05 AM, "Yuri" <[hidden email]> wrote:

> This patch is from my company's mercurial repo and is made against 1.7.3 release. Is it useful? Are you interested in it?

If it impacts code that isn't specific to a Xalan build, I would be unlikely to be able to test it sufficiently to trust it. If it's XPath only, I really don't care, so I'd probably just accept it after an eyeballing. Xalan is all but dead, and won't even build with the version of Xerces that the next release of this library will require.

Secondly, it would have to be filed in Jira with an appropriate license unless you've filled out an Apache contribution agreement.

-- Scott