-
-
Notifications
You must be signed in to change notification settings - Fork 903
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
[JRuby] namespaced attributes broken when appending raw xml to builder #770
Comments
To give some context on this, Avin posted the following in the google group.
I would expect builder.doc.to_xml to produce:
However, calling builder.doc.to_xml actually produces:
Note the lower case element and missing attribute prefix. Interestingly, if I change the case to:
Then builder.doc.to_xml will have the correctly cased element, but is still missing the attribute prefix. |
I think my test case captures the requirements. If it doesn't, then please submit a revised test case that does. |
There are two problems that lead to the failure. First, the current Java implementation of XmlNode::in_context() doesn't parse the xml in the context of the root node, therefore the prefix 'foo' is left unbound. The second problem is in XmlNode::parse. There's a hack that deals with issue #313 by falling back to parsing the XML as HTML. This causes the tag to loose its case and ignores the unknown prefix 'foo' (remember in_context is still not doing the right thing but the HTML parser is more permissive). Ideally I'd have used Xerces to parse the given XML in context of another node. Unfortunately, this feature isn't implemented yet https://issues.apache.org/jira/browse/XERCESJ-1429. I'm still trying to work around the problem. @yokolet, any input would be appreciated. |
DocumentFragment parsing which depends on Xml::Node::parse didn't properly handle namespaces in context. Ideally we should be using Xerces parsing with a hint to the context node, but unfortunately this feature isn't implemented yet https://issues.apache.org/jira/browse/XERCESJ-1429 which is why we manually add namespace declarations to the fake root that encapsulates the document fragment.
From nokogiri-talk thread here:
The text was updated successfully, but these errors were encountered: