Skip to content

Releases: tafia/quick-xml

Support serve >=1.0.181, various serde fixes and async writer

22 Oct 07:04
Compare
Choose a tag to compare

What's Changed

MSRV bumped to 1.56! Crate now uses Rust 2021 edition.

鈿狅笍 BREAKING CHANGE! Serde's enum representation was changed (it was buggy anyway) to ensure compatibility with serde >= 1.0.181.

New Features

  • #545: Resolve well-known namespaces (xml and xmlns) 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:lists from empty tags (<tag/> or <tag></tag>). Previously an DeError::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 after 123 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 simpleTypes (for example, attributes) into Option fields: now they are always deserialized as Some("").

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 added ElementWriter::write_inner_content_async of 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

Full Changelog: v0.30.0...v0.31.0

Serde support improvements and bugfix

23 Jul 19:41
Compare
Choose a tag to compare

What's Changed

New Features

Bug Fixes

  • #604: Avoid crashing on wrong comments like <!--> when using read_event_into* functions.

Misc Changes

New Contributors

Full Changelog: v0.29.0...v0.30.0

Serde helpers and indentation for async writer

12 Jun 19:48
Compare
Choose a tag to compare

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 returning DeError::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

Full Changelog: v0.28.2...v0.29.0

EntityResolver for deserializer and export EscapeError

12 Apr 15:28
Compare
Choose a tag to compare

What's Changed

New Features

  • #581: Allow Deserializer to set quick_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 use FnMut instead of Fn for resolve_entity parameters, like Iterator::map from std.

New Contributors

Full Changelog: v0.28.1...v0.28.2

Relax requirements in `ElementWriter.write_inner_content`

19 Mar 14:07
Compare
Choose a tag to compare

What's Changed

Misc Changes

  • #579: ElementWriter.write_inner_content now uses a FnOnce instead of a more restrictive Fn closure

New Contributors

  • @Tpt made their first contribution in #579

Full Changelog: v0.28.0...v0.28.1

Improvements in serde and async

13 Mar 15:13
Compare
Choose a tag to compare

What's Changed

New Features

  • #541: (De)serialize specially named $text enum variant in externally tagged
    enums to / from textual content
  • #556: to_writer and to_string now accept ?Sized types
  • #556: Add new to_writer_with_root and to_string_with_root helper functions
  • #520: Add methods BytesText::inplace_trim_start and BytesText::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 into Writter::get_mut
  • #568: Add method Writter::get_ref
  • #569: Rewrite the Reader::read_event_into_async as an async fn, making the future Send if possible.
  • #571: Borrow element names (<element>) when deserialize with serde.
    This change allow to deserialize into HashMap<&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 where T is some
    sequence type (for example, Vec or tuple)
  • #540: Fix a compilation error (probably a rustc bug) in some circumstances.
    Serializer::new and Serializer::with_root now accepts only references to Writer.
  • #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 by DeEvent::Text with merged content.
    The same behavior for the Reader 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

Full Changelog: v0.27.1...v0.28.0

Fix an infinite loop in some circumstates

28 Dec 16:00
Compare
Choose a tag to compare

What's Changed

Bug Fixes

  • #530: Fix an infinite loop leading to unbounded memory consumption that occurs when
    skipping events on malformed XML with the overlapped-lists feature active.
  • #530: Fix an error in the Deserializer::read_to_end when overlapped-lists
    feature is active and malformed XML is parsed

Full Changelog: v0.27.0...v0.27.1

Improvements in serde deserializer and MSRV bumped to 1.52

25 Dec 12:23
Compare
Choose a tag to compare

What's Changed

MSRV was increased from 1.46 to 1.52 in #521.

New Features

  • #521: Implement Clone for all error types. This required changing Error::Io to contain
    Arc<std::io::Error> instead of std::io::Error since std::io::Error does not implement
    Clone.

Bug Fixes

  • #490: Ensure that serialization of map keys always produces valid XML names.
    In particular, that means that maps with numeric and numeric-like keys (for
    example, "42") no longer can be serialized because XML name cannot start
    from a digit
  • #500: Fix deserialization of top-level sequences of enums, like
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- list of enum Enum { A, B, 小 } -->
    <A/>
    <B/>
    <C/>
  • #514: Fix wrong reporting Error::EndEventMismatch after disabling and enabling
    .check_end_names
  • #517: Fix swapped codes for \r and \n characters when escaping them
  • #523: Fix incorrect skipping text and CDATA content before any map-like structures
    in serde deserializer, like
    unwanted text<struct>...</struct>
  • #523: Fix incorrect handling of xs:lists with encoded spaces: they still
    act as delimiters, which is confirmed also by mature XmlBeans Java library
  • #473: Fix a hidden requirement to enable serde's derive feature to get
    quick-xml's serialize feature for edition = 2021 or resolver = 2 crates

Misc Changes

  • #490: Removed $unflatten= special prefix for fields for serde (de)serializer, because:

    • it is useless for deserializer
    • serializer was rewritten and does not require it anymore

    This prefix allowed you to serialize struct field as an XML element and now
    replaced by a more thoughtful system explicitly indicating that a field should
    be serialized as an attribute by prepending @ character to its name

  • #490: Removed $primitive= prefix. That prefix allowed you to serialize struct
    field as an attribute instead of an element and now replaced by a more thoughtful
    system explicitly indicating that a field should be serialized as an attribute
    by prepending @ character to its name

  • #490: In addition to the $value special name for a field a new $text
    special name was added:

    • $text is used if you want to map field to text content only. No markup is
      expected (but text can represent a list as defined by xs:list type)
    • $value is used if you want to map elements with different names to one field,
      that should be represented either by an enum, or by sequence of enums
      (Vec, tuple, etc.), or by string. Use it when you want to map field to any
      content of the field, text or markup

    Refer to documentation for details.

  • #521: MSRV bumped to 1.52.

  • #473: serde feature that used to make some types serializable, renamed to serde-types

  • #528: Added documentation for XML to serde mapping

New Contributors

Full Changelog: v0.26.0...v0.27.0