-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
encoding/xml: XML CDATA section could be joined together with regular characters #12611
Comments
also is a problem if the xml element contains indented children and a cdata section example:
",cdata" of parent ends up being: workaround is to use ",innerxml" and create a custom marshalXML/unmarshalXML method for your datatype |
Two comments from me:
|
You said:
I agree. However I can't distinguish cdata sections using unmarshal, and I can't distinguish cdata sections using token. This behavior is not to spec:When I simply write what I read using unmarshal and then marshal these types of cdata sections get a ton of extra newlines (in addition to the regular indent ones) all wrapped in cdata. Aka crazy output. Very much against section 2.11 |
Example crazy output using ",cdata": Input of 'Unmarshal'
Output of 'MarshalIndent'
|
I still believe this is a different issue, related but not the same as this one. I am not the author of the XML package, so I can't give an authorative answer. Perhaps you should post code in a new bug report which shows the behaviour? This makes it easier to reproduce the problem. Your “crazy output” seems crazy to me, too. I think you have hit a bug, while my issue is just a nuisance. |
Fair enough, thanks for your feedback, and have a Merry Christmas |
go version go1.5 darwin/amd64
One thing I stumbled across yesterday (not a real bug, but a minor nuisance from a user's perspective perhaps):
gives
I would expect one
xml.CharData{}
token instead:While I understand the source of the three tokens, I would expect one as the user (= me) is unable to distinguish between a CDATA node and a regular text node.
The text was updated successfully, but these errors were encountered: