[PATCH] Teach xmerl_xpath to resolve context namespaces in more cases
Daniel White <[email protected]>
| Newsgroups | gmane.comp.lang.erlang.patches |
|---|---|
| Message-ID | <CAMD5n_0B_bF_ohOZgQuUm0Qudnv3EVp_JyYdxvD2ZwzXYs8SqQ@mail.gmail.com> |
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
_______________________________________________
erlang-patches mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-patches