Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removal of namespace declaration breaks type attribute #73

Open
ptandara opened this issue May 2, 2019 · 3 comments
Open

Removal of namespace declaration breaks type attribute #73

ptandara opened this issue May 2, 2019 · 3 comments

Comments

@ptandara
Copy link

ptandara commented May 2, 2019

When the following XML is converted to an OMElement, then written back out, the namespace prefix used by the xsi:type attribute refers to the incorrect namespace URI. That is because the local prefix mapping used in the type name reference is removed from the element that contains the type attribute during parsing.

It appears to be caused by a null return value from the getNsBuilder method of AttributeCollector when it thinks the namespace declaration is redundant.

Original XML:
<ns1:A xmlns:ns1="urn:foo">
<ns1:B xmlns:ns1="urn:bar">
<ns2:C xmlns:ns1="urn:foo" xmlns:ns2="urn:bar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:TypeA"/>
</ns1:B>
</ns1:A>

After conversion to OMElement, xsi:type name cannot be resolved because it is mapped to the wrong namespace URI:
<ns1:A xmlns:ns1="urn:foo">
<ns1:B xmlns:ns1="urn:bar">
<ns2:C xmlns:ns2="urn:bar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:TypeA"/>
</ns1:B>
</ns1:A>

@cowtowncoder
Copy link
Member

What is OMElement? Do you have code to share to show the details?

@ptandara
Copy link
Author

ptandara commented May 3, 2019 via email

@cowtowncoder
Copy link
Member

Unfortunately I can only help with Woodstox-only part: it may make sense to work with Axiom folks first as integrations often cause problems -- and if it turns out Woodstox has some specific problem add that info.

This because Woodstox does not have any known namespace binding problems and I do not have time or interest to dig through Axiom codebase to see what translations they might do.

About the only thing I would suggest is just that for output they really should use "namespace" repairing mode as that ensures that namespace declarations can not be omitted, and bindings that might be missing are added automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants