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

Serialization uses mix of nsURI and nsPrefix #13

Open
Phrogz opened this issue Oct 23, 2018 · 0 comments
Open

Serialization uses mix of nsURI and nsPrefix #13

Phrogz opened this issue Oct 23, 2018 · 0 comments

Comments

@Phrogz
Copy link
Owner

Phrogz commented Oct 23, 2018

Building a DOM from scratch to seraialize requires creating nsPrefix properties on elements and attributes, but also maintaining proper nsURI if you want to use the omit option during serialization.

Might be better to remove nsPrefix from the DOM and instead decide the prefix based on the defined prefixes (favoring the closest ancestor), based on parsing xmlns:foo attributes during serialization.

Positive: fewer moving parts to keep track of, and fixes the bug that allows serialization of invalid documents. When serializing subtrees could even provide the option of generating namespace attributes as necessary.

Negative: would probably no longer round-trip something like this:

<a:foo xmlns="uriA" xmlns:a="uriA"><a:bar /></a:foo>

...because the serializer would see that bar was in uriA namespace and deduce that since its parent element had declared that as a default namespace the output out to be:

<foo xmlns="uriA" xmlns:a="uriA"><bar /></foo>
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

1 participant