Releases: tafia/quick-xml
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_value
andAttribute::decode_and_unescape_value_with
now acceptsDecoder
instead ofReader
. UseReader::decoder()
to get it. - #760:
Writer::write_event
now consumes event. UseEvent::borrow()
if you want to keep ownership. - #751: Type of
Reader::error_position()
andReader::buffer_position()
changed fromusize
tou64
. - #751: Type alias
Span
changed 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>
forBytesStart
andBytesEnd
.
Bug Fixes
- #755: Fix incorrect missing of trimming all-space text events when
trim_text_start = false
andtrim_text_end = true
.
Misc Changes
- #650: Change the type of
Event::PI
to a new dedicatedBytesPI
type. - #759: Make
const
as 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_entity
underescape-html
feature 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 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
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 (
xml
andxmlns
) to their appropriate URIs. Also, enforce namespace constraints related to these well-known namespaces. - #635: Add support for async
ElementWriter
operations.
Bug Fixes
- #660: Fixed incorrect deserialization of
xs:list
s 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 after123
up to closing tag would be silently skipped. - #567: Fixed incorrect deserialization of vectors of enums from sequences of tags.
- #671: Fixed deserialization of empty
simpleType
s (for example, attributes) intoOption
fields: 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
Error
variant --Error::InvalidPrefixBind
. - #651: Relax requirement for version of
arbitrary
dependency -- 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_async
of course). - #662: Get rid of some allocations during serde deserialization.
- #665: Improve serialization of
xs:list
s 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_serializable
to provide the capability to serialize arbitrary types using serde when using the lower-levelWriter
API. - #615: Added
Deserializer::from_str_with_resolver
to set entity resolver when deserialize using borrowing reader. - #617: Added
Serializer::expand_empty_elements
to 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
Serde helpers and indentation for async writer
What's Changed
New Features
- #601: Add
serde_helper
module to the crate root with some useful utility
functions and document using of enum's unit variants as a text content of element. - #606: Implement indentation for
AsyncWrite
trait implementations.
Bug Fixes
- #603: Fix a regression from #581 that an XML comment or a processing
instruction between a <!DOCTYPE> and the root element in the file brokes
deserialization of structs by returningDeError::ExpectedStart
- #608: Return a new error
Error::EmptyDocType
on empty doctype instead
of crashing because of a debug assertion.
Misc Changes
- #594: Add a helper macro to help deserialize internally tagged enums
with Serde, which doesn't work out-of-box due to serde limitations.
New Contributors
- @damb made their first contribution in #606
- @danjpgriffin made their first contribution in #603
- @Kriskras99 made their first contribution in #594
Full Changelog: v0.28.2...v0.29.0
EntityResolver for deserializer and export EscapeError
What's Changed
New Features
- #581: Allow
Deserializer
to setquick_xml::de::EntityResolver
for resolving unknown entities that would otherwise cause the parser to return an [EscapeError::UnrecognizedSymbol
] error.
Misc Changes
- #584: Export
EscapeError
from the crate - #581: Relax requirements for
unsescape_*
set of functions -- their now useFnMut
instead ofFn
forresolve_entity
parameters, likeIterator::map
fromstd
.
New Contributors
- @Aaron1011 made their first contribution in #584
- @pigeonhands made their first contribution in #583
Full Changelog: v0.28.1...v0.28.2
Relax requirements in `ElementWriter.write_inner_content`
What's Changed
Misc Changes
- #579:
ElementWriter.write_inner_content
now uses aFnOnce
instead of a more restrictiveFn
closure
New Contributors
Full Changelog: v0.28.0...v0.28.1
Improvements in serde and async
What's Changed
New Features
- #541: (De)serialize specially named
$text
enum variant in externally tagged
enums to / from textual content - #556:
to_writer
andto_string
now accept?Sized
types - #556: Add new
to_writer_with_root
andto_string_with_root
helper functions - #520: Add methods
BytesText::inplace_trim_start
andBytesText::inplace_trim_end
to trim leading and trailing spaces from text events - #565: Allow deserialize special field names
$value
and$text
into borrowed
fields when use serde deserializer - #568: Rename
Writter::inner
intoWritter::get_mut
- #568: Add method
Writter::get_ref
- #569: Rewrite the
Reader::read_event_into_async
as an async fn, making the futureSend
if possible. - #571: Borrow element names (
<element>
) when deserialize with serde.
This change allow to deserialize intoHashMap<&str, T>
, for example - #573: Add basic support for async byte writers via tokio's
AsyncWrite
.
Bug Fixes
- #537: Restore ability to deserialize attributes that represents XML namespace
mappings (xmlns:xxx
) that was broken since #490 - #510: Fix an error of deserialization of
Option<T>
fields whereT
is some
sequence type (for example,Vec
or tuple) - #540: Fix a compilation error (probably a rustc bug) in some circumstances.
Serializer::new
andSerializer::with_root
now accepts only references toWrite
r. - #520: Merge consequent (delimited only by comments and processing instructions)
texts and CDATA when deserialize using serde deserializer.DeEvent::Text
and
DeEvent::CData
events was replaced byDeEvent::Text
with merged content.
The same behavior for theReader
does not implemented (yet?) and should be
implemented manually - #562: Correctly set minimum required version of memchr dependency to 2.1
- #565: Correctly set minimum required version of tokio dependency to 1.10
- #565: Fix compilation error when build with serde <1.0.139
New Contributors
- @emarsden made their first contribution in #535
- @dacut made their first contribution in #494
- @silvergasp made their first contribution in #554
- @dburgener made their first contribution in #562
- @martsokha made their first contribution in #568
- @vilunov made their first contribution in #569
Full Changelog: v0.27.1...v0.28.0
Fix an infinite loop in some circumstates
What's Changed
Bug Fixes
- #530: Fix an infinite loop leading to unbounded memory consumption that occurs when
skipping events on malformed XML with theoverlapped-lists
feature active. - #530: Fix an error in the
Deserializer::read_to_end
whenoverlapped-lists
feature is active and malformed XML is parsed
Full Changelog: v0.27.0...v0.27.1