Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #311, closes #370.
Now
CData
event has its own dedicated typeBytesCData
instead ofBytesText
. New type can be converted toBytesText
by calling.escape()
method, so migrating should be easy, but it is better to review usages, because usually you want to have unescaped data and CDATA section already provide them.The API a bit dangerous because it not checked for forbidden sequence
]]>
-- you can create aBytesCData
containing it. Because this is general problem with other event content types, I leaved it now as is. This API should be fixed in another PR.This PR changes how raw bytes are deserialized, for example, to a
Vec<u8>
. Before such field always get a unmodified content from the reader -- it means that you can consider raw bytes types as a way to access to raw reader content in your structs. This is dangerous practice, because other formats do not behave like this. Actually, I would prefer to prohibit (de)serializing (into)Vec<u8>
and similar at all. This is conceptually right, but maybe unpractical. So now bytes deserialized similarly to strings -- text content unescaped, CDATA content remained unchanged.I'm thinking about providing encoding handler to a (de)serializer, that should be used to encode / decode binary data to strings, that will be stored in XML, for example, hex, or base64, and by default (
handler == None
) emit an error on attempt (de)serializing binary data. But this is for another PR.Unescaping takes into account only default XML entities, namely
<
,>
,&
,'
, and"
. Adding support for document-defined entities is the purpose for another PR.