[erlang-patches] [PATCH] Teach xmerl_xpath to resolve context namespaces in more cases

Daniel White daniel@REDACTED
Thu Sep 12 18:52:22 CEST 2013


These patches teach attribute name tests and node prefix (wildcard)
name tests to behave like element name tests.

Assuming the following document has been scanned with
`{namespace_conformant, true}`:

<root xmlns:ns1="http://www.example.com/ns">
  <child ns1:attr="example" />
</root>

The current behaviour is as such:

> [#xmlElement{}] = xmerl_xpath:string("/root/ns1:child", Doc).
> [#xmlAttribute{}] = xmerl_xpath:string("/root/ns1:child/@ns1:attr", Doc).
> [#xmlElement{}] = xmerl_xpath:string("/root/t:child", Doc,  [{namespace, [{"t", "http://www.example.com/ns"}]}]).
> [] = xmerl_xpath:string("/root/t:child/@t:attr", Doc,  [{namespace, [{"t", "http://www.example.com/ns"}]}]).

The latter case here is surprising, and should return the attribute as
it can be resolved by the provided namespace.


git fetch git://github.com/danielwhite/otp.git
xmerl-xpath-resolve-context-namespaces

https://github.com/danielwhite/otp/compare/xmerl-xpath-resolve-context-namespaces
https://github.com/danielwhite/otp/compare/xmerl-xpath-resolve-context-namespaces.patch

Cheers,

--
Daniel White



More information about the erlang-patches mailing list