v0.32.0
Significant Changes
The method of reporting positions of errors has changed - use error_position()
to get an offset of the error position. For SyntaxError
s the range error_position()..buffer_position()
also will represent a span of error.
⚠️ Breaking Changes
The way to configure parser has changed. Now all configuration is contained in the Config
struct and can be applied at once. When serde-types
feature is enabled, configuration is serializable.
The way of resolve entities with unescape_with
has changed. Those methods no longer resolve predefined entities (lt
, gt
, apos
, quot
, amp
). NoEntityResolver
renamed to PredefinedEntityResolver
.
Writer::create_element
now accepts impl Into<Cow<str>>
instead of &impl AsRef<str>
.
Minimum supported version of serde raised to 1.0.139
The full changelog is below.
What's Changed
New Features
- #513: Allow to continue parsing after getting new
Error::IllFormed
. - #677: Added methods
config()
andconfig_mut()
to inspect and change the parser configuration. Previous builder methods onReader
/NsReader
was replaced by direct access to fields of config usingreader.config_mut().<...>
. - #684: Added a method
Config::enable_all_checks
to turn on or off all well-formedness checks. - #362: Added
escape::minimal_escape()
which escapes only&
and<
. - #362: Added
BytesCData::minimal_escape()
which escapes only&
and<
. - #362: Added
Serializer::set_quote_level()
which allow to set desired level of escaping. - #705: Added
NsReader::prefixes()
to list all the prefixes currently declared. - #629: Added a default case to
impl_deserialize_for_internally_tagged_enum
macro so that it can handle every attribute that does not match existing cases within an enum variant. - #722: Allow to pass owned strings to
Writer::create_element
. This is breaking change! - #275: Added
ElementWriter::new_line()
which enables pretty printing elements with multiple attributes. - #743: Added
Deserializer::get_ref()
to get XML Reader from serde Deserializer - #734: Added helper functions to resolve predefined XML and HTML5 entities:
quick_xml::escape::resolve_predefined_entity
quick_xml::escape::resolve_xml_entity
quick_xml::escape::resolve_html5_entity
- #753: Added parser for processing instructions:
quick_xml::reader::PiParser
. - #754: Added parser for elements:
quick_xml::reader::ElementParser
.
Bug Fixes
- #622: Fix wrong disregarding of not closed markup, such as lone
<
. - #684: Fix incorrect position reported for
Error::IllFormed(DoubleHyphenInComment)
. - #684: Fix incorrect position reported for
Error::IllFormed(MissingDoctypeName)
. - #704: Fix empty tags with attributes not being expanded when
expand_empty_elements
is set to true. - #683: Use local tag name when check tag name against possible names for field.
- #753: Correctly determine end of processing instructions and XML declaration.
Misc Changes
- #675: Minimum supported version of serde raised to 1.0.139
- #675: Rework the
quick_xml::Error
type to provide more accurate information:Error::EndEventMismatch
replaced byIllFormedError::MismatchedEndTag
in some casesError::EndEventMismatch
replaced byIllFormedError::UnmatchedEndTag
in some casesError::TextNotFound
was removed because not usedError::UnexpectedBang
replaced bySyntaxError
Error::UnexpectedEof
replaced bySyntaxError
in some casesError::UnexpectedEof
replaced byIllFormedError
in some casesError::UnexpectedToken
replaced byIllFormedError::DoubleHyphenInComment
Error::XmlDeclWithoutVersion
replaced byIllFormedError::MissingDeclVersion
(in #684)Error::EmptyDocType
replaced byIllFormedError::MissingDoctypeName
(in #684)
- #684: Changed positions reported for
SyntaxError
s: now they are always points to the start of markup (i. e. to the<
character) with error. Useerror_position()
for that. - #684: Now
<??>
parsed asEvent::PI
with empty content instead of raising syntax error. - #684: Now
<?xml?>
parsed asEvent::Decl
instead ofEvent::PI
. - #362: Now default quote level is
QuoteLevel::Partial
when using serde serializer. - #689:
buffer_position()
now always report the position the parser last seen. To get an error position useerror_position()
. - #738: Add an example of how to deserialize XML elements into Rust enums using an intermediate custom deserializer.
- #748: Implement
Clone
forDeEvent
,PayloadEvent
andText
. - #734: Rename
NoEntityResolver
toPredefinedEntityResolver
. - #734: No longer resolve predefined entities (
lt
,gt
,apos
,quot
,amp
) inunescape_with
family of methods. You should do that by yourself using the one of the following methods:quick_xml::escape::resolve_predefined_entity
quick_xml::escape::resolve_xml_entity
quick_xml::escape::resolve_html5_entity
New Contributors
- @Thomblin made their first contribution in #696
- @M-Valts made their first contribution in #704
- @Frankkkkk made their first contribution in #738
- @aesteve made their first contribution in #634
- @2xsaiko made their first contribution in #722
- @leftmostcat made their first contribution in #702
- @alisianoi made their first contribution in #745
- @areleu made their first contribution in #731
- @dishmaker made their first contribution in #743
- @phdavis1027 made their first contribution in #739
Full Changelog: v0.31.0...v0.32.0