Releases: tafia/quick-xml
v0.37.0 - serde & errors imporvements
What's Changed
⚠️ Significant Changes
Those changes could require not trivial adoption of your code:
- The recognized boolean values in serde
Deserializerare reduced. Use#[serde(deserialize_with)]which will accept and parse strings if you need the old behavior. Serializerno longer serialize consequent primitive values (those which would produce only text, without surrounding tags), because it is impossible to deserialize them back to the same value.- The crate's errors was changed, some variants was splitted to their own error types, some removed.
New Features
- #826: Implement
From<String>andFrom<Cow<str>>forquick_xml::de::Text. - #826: Make
SimpleTypeDeserializerandSimpleTypeSerializerpublic. - #826: Implement
IntoDeserializerfor&mut Deserializer.
Bug Fixes
- #655: Do not write indent before and after
$textfields and those$valuefields that are serialized as a text (for example,usizeorString). - #826: Handle only those boolean representations that are allowed by Xml Schema which is only
"true","1","false", and"0". Previously the following values also was accepted:boolXML content true"True","TRUE","t","Yes","YES","yes","y"false"False","FALSE","f","No","NO","no","n"
Misc Changes
- #227: Split
SeErrorfromDeErrorin theserializefeature. Serialize functions and methods now returnSeError. - #810: Return
std::io::ErrorfromWritermethods. - #811: Split
NamespaceErrorandEncodingErrorfromError. - #811: Renamed
Error::EscapeErrortoError::Escapeto match other variants. - #811: Narrow down error return type from
Errorwhere only one variant is ever returned: attribute related methods onBytesStartandBytesDeclreturnsAttrError. - #820: Classify output of the
Serializerby returning an enumeration with kind of written data. - #823: Do not allow serialization of consequent primitives, for example
Vec<usize>orVec<String>in$valuefields. They cannot be deserialized back with the same result. - #827: Make
escapeand it variants take aimpl Into<Cow<str>>argument and implementFrom<(&'a str, Cow<'a, str>)>onAttribute. - #826: Removed
DeError::InvalidInt,DeError::InvalidFloatandDeError::InvalidBoolean. Now the responsibility for returning the error lies with the visitor of the type. See rationale in serde-rs/serde#2811
New Contributors
- @RedPhoenixQ made their first contribution in #810
Full Changelog: v0.36.2...v0.37.0
v0.36.2 - Fix DOCTYPE parsing
What's Changed
Bug Fixes
- #533: Fix incorrect DocType closing bracket detection when parsing with buffered reader
Full Changelog: v0.36.1...v0.36.2
v0.36.1 - Read binary from XML
What's Changed
New Features
- #623: Added
Reader::stream()that can be used to read arbitrary data from the inner reader while track position for XML reader.
Full Changelog: v0.36.0...v0.36.1
v0.36.0 - Compatibility with Adobe Flash
What's Changed
Bug Fixes
- #781: Fix conditions to start CDATA section. Only uppercase
<![CDATA[can start it.
Previously any case was allowed. - #780: Fixed incorrect
.error_position()when encountering syntax error for open or self-closed tag.
Misc Changes
- #780:
reader::Parser,reader::ElementParserandreader::PiParsermoved to the new moduleparser. - #776: Allow to have attributes in the end tag for compatibility reasons with Adobe Flash XML parser.
Full Changelog: v0.35.0...v0.36.0
v0.35.0 - a couple of bugfixes
What's Changed
New Features
- #772: Add
reader::Config::allow_unmatched_endsto permit dangling end tags.
Bug Fixes
- #773: Fixed reporting incorrect end position in
Reader::read_to_endfamily of methods and trimming of the trailing spaces inReader::read_textwhentrim_text_startis set and the last event is not aTextevent. - #771: Character references now allow any number of leading zeroes as it should. As a result, the following variants of
quick_xml::escape::EscapeErrorare removed:TooLongDecimalTooLongHexadecimal
- #771: Fixed
Attribute::unescape_valuewhich does not unescape predefined values since 0.32.0. - #774: Fixed regression since 0.33.0:
Textevent may be skipped inread_event_into()andread_event_into_async()in some circumstances.
Misc Changes
- #771:
EscapeError::UnrecognizedSymbolrenamed toEscapeError::UnrecognizedEntity. - #771: Implemented
PartialEqforEscapeError. - #771: Replace the following variants of
EscapeErrorbyInvalidCharRefvariant with a newParseCharRefErrorinside:EntityWithNullInvalidDecimalInvalidHexadecimalInvalidCodepoint
New Contributors
- @torokati44 made their first contribution in #772
Full Changelog: v0.34.0...v0.35.0
v0.34.0 - allow to read 4GB+ files on 32-bit targets
What's Changed
Bug Fixes
- #751: Fix internal overflow when read 4GB+ files on 32-bit targets using
Reader<impl BufRead>readers.
Misc Changes
- #760:
Attribute::decode_and_unescape_valueandAttribute::decode_and_unescape_value_withnow acceptsDecoderinstead ofReader. UseReader::decoder()to get it. - #760:
Writer::write_eventnow consumes event. UseEvent::borrow()if you want to keep ownership. - #751: Type of
Reader::error_position()andReader::buffer_position()changed fromusizetou64. - #751: Type alias
Spanchanged fromRange<usize>toRange<u64>.
Full Changelog: v0.33.0...v0.34.0
v0.33.0 - Make compile time small again
What's Changed
New Features
- #758: Implemented
From<QName>forBytesStartandBytesEnd.
Bug Fixes
- #755: Fix incorrect missing of trimming all-space text events when
trim_text_start = falseandtrim_text_end = true.
Misc Changes
- #650: Change the type of
Event::PIto a new dedicatedBytesPItype. - #759: Make
constas much functions as possible:resolve_html5_entity()resolve_predefined_entity()resolve_xml_entity()Attr::key()Attr::value()Attributes::html()Attributes::new()BytesDecl::from_start()Decoder::encoding()Deserializer::get_ref()IoReader::get_ref()LocalName::into_inner()Namespace::into_inner()NsReader::config()NsReader::prefixes()Prefix::into_inner()QName::into_inner()Reader::buffer_position()Reader::config()Reader::decoder()Reader::error_position()Reader::get_ref()SliceReader::get_ref()Writer::get_ref()Writer::new()
- #763: Hide
quick_xml::escape::resolve_html5_entityunderescape-htmlfeature again.
This function has significant influence to the compilation time (10+ seconds or 5x times)
Full Changelog: v0.32.0...v0.33.0
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 SyntaxErrors 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/NsReaderwas replaced by direct access to fields of config usingreader.config_mut().<...>. - #684: Added a method
Config::enable_all_checksto 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_enummacro 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_entityquick_xml::escape::resolve_xml_entityquick_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_elementsis 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::Errortype to provide more accurate information:Error::EndEventMismatchreplaced byIllFormedError::MismatchedEndTagin some casesError::EndEventMismatchreplaced byIllFormedError::UnmatchedEndTagin some casesError::TextNotFoundwas removed because not usedError::UnexpectedBangreplaced bySyntaxErrorError::UnexpectedEofreplaced bySyntaxErrorin some casesError::UnexpectedEofreplaced byIllFormedErrorin some casesError::UnexpectedTokenreplaced byIllFormedError::DoubleHyphenInCommentError::XmlDeclWithoutVersionreplaced byIllFormedError::MissingDeclVersion(in #684)Error::EmptyDocTypereplaced byIllFormedError::MissingDoctypeName(in #684)
- #684: Changed positions reported for
SyntaxErrors: 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::PIwith empty content instead of raising syntax error. - #684: Now
<?xml?>parsed asEvent::Declinstead ofEvent::PI. - #362: Now default quote level is
QuoteLevel::Partialwhen 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
CloneforDeEvent,PayloadEventandText. - #734: Rename
NoEntityResolvertoPredefinedEntityResolver. - #734: No longer resolve predefined entities (
lt,gt,apos,quot,amp) inunescape_withfamily of methods. You should do that by yourself using the one of the following methods:quick_xml::escape::resolve_predefined_entityquick_xml::escape::resolve_xml_entityquick_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
Support serve >=1.0.181, various serde fixes and async writer
What's Changed
MSRV bumped to 1.56! Crate now uses Rust 2021 edition.
New Features
- #545: Resolve well-known namespaces (
xmlandxmlns) to their appropriate URIs. Also, enforce namespace constraints related to these well-known namespaces. - #635: Add support for async
ElementWriteroperations.
Bug Fixes
- #660: Fixed incorrect deserialization of
xs:lists from empty tags (<tag/>or<tag></tag>). Previously anDeError::UnexpectedEof")was returned in that case. - #580: Fixed incorrect deserialization of vectors of newtypes from sequences of tags.
- #661: More string handling of serialized primitive values (booleans, numbers, strings, unit structs, unit variants).
<int>123<something-else/></int>is no longer valid content. Previously all data after123up to closing tag would be silently skipped. - #567: Fixed incorrect deserialization of vectors of enums from sequences of tags.
- #671: Fixed deserialization of empty
simpleTypes (for example, attributes) intoOptionfields: now they are always deserialized asSome("").
Misc Changes
- #643: Bumped MSRV to 1.56. In practice the previous MSRV was incorrect in many cases.
- #643: Adopted Rust 2021 edition.
- #545: Added new
Errorvariant --Error::InvalidPrefixBind. - #651: Relax requirement for version of
arbitrarydependency -- we're actually compatible with version 1.0.0 and up. - #649: Make features linkable and reference them in the docs.
- #619: Allow to raise application errors in
ElementWriter::write_inner_content(and newly addedElementWriter::write_inner_content_asyncof course). - #662: Get rid of some allocations during serde deserialization.
- #665: Improve serialization of
xs:lists when some elements serialized to an empty string. - #630: Fixed compatibility with serde >= 1.0.181
New Contributors
- @wt made their first contribution in #545
- @tevoinea made their first contribution in #635
- @dev-ardi made their first contribution in #647
Full Changelog: v0.30.0...v0.31.0
Serde support improvements and bugfix
What's Changed
New Features
- #609: Added
Writer::write_serializableto provide the capability to serialize arbitrary types using serde when using the lower-levelWriterAPI. - #615: Added
Deserializer::from_str_with_resolverto set entity resolver when deserialize using borrowing reader. - #617: Added
Serializer::expand_empty_elementsto enforce the expansion of empty elements.
Bug Fixes
- #604: Avoid crashing on wrong comments like
<!-->when usingread_event_into*functions.
Misc Changes
New Contributors
Full Changelog: v0.29.0...v0.30.0