-
Notifications
You must be signed in to change notification settings - Fork 63
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
Problems with Newline Characters in Attributes #177
Comments
I believe this is the expected behaviour. Indeed, character references are parsed into In other words, the parsing logic is known to be lossy (as is the rendering logic), and in general, To support your specific use case, I guess we could add a Note: |
A Why do roundtrips not work? Does this have to do with the general complexity of XML? Are other xml libraries (maybe also based on other languages) roundtrip save or is roundtrip safety not feasible from an implementation point of view? |
The following is just my 2 cents, feel free to challenge what I'm about to say :) . The XML standard is such that for a given abstract piece of information, there are multiple valid XML documents to express it (e.g. newlines may, or may not, be hex-encoded). This relaxed contract allows simplifications/shortcuts to optimize performance, memory usage, and incidentally to have a more maintainable codebase that doesn't inherit all peculiarities of the XML standard (for the rendering part, at least). If you care about enforcing a particular XML representation of your data, then I guess you're looking for an XML formatter, which |
I am using
xml-conduit
to parse xml, adjust it and render it again.I don't know if this is a bug or expected behaviour, but when parsing newlines encoded as


they are stored as newlines\n
in memory. When rendered as xml they do not seem to be replaced by

.So following element goes from:
to:
Is that expected behaviour? I have found the
ParsingSetting: DecodeIllegalCharacters
but the output type is just a single character. So I am not sure how exactly I would use this to prevent such behaviour. I also didn't find anyRenderSettings
that could be used.The text was updated successfully, but these errors were encountered: