Skip to content

Upgrading quick-xml 0.31 to 0.32

Breaking0.31.0 → 0.32.0Breaking17New14Changed7Fixed6Other1

BreakingUpgrade verdict

14 breaking changes.

  • Entity unescaping no longer handles the five built-in XML entities, and one resolver type has a new name.
  • Error values returned by the parser have changed, so code that matches on specific error variants may need updating.
  • Removes the unused Error::TextNotFound variant.
  • If you read where errors happen, the way that location is reported has changed.
Top 3 of 14 that need code or config changes
Breaking14
Changes unescape_with so it no longer resolves predefined entities (lt, gt, apos, quot, amp), and renames NoEntityResolver to PredefinedEntityResolver.
unescape_withNoEntityResolverPredefinedEntityResolver
Reworks the quick_xml::Error type, replacing or removing several variants for more accurate error information.
quick_xml::ErrorError::EndEventMismatchIllFormedError::MismatchedEndTagIllFormedError::UnmatchedEndTagError::TextNotFoundError::UnexpectedBangError::UnexpectedEofError::UnexpectedToken
Removes the unused Error::TextNotFound variant.
Error::TextNotFound
Changes how error positions are reported; use error_position() to get the error offset, and for SyntaxErrors the span is error_position()..buffer_position().
error_position()buffer_position()SyntaxError
Moves all parser configuration into the Config struct, applied at once, and makes it serializable when the serde-types feature is enabled.
Configserde-types
Changes Writer::create_element to accept impl Into<Cow<str>> instead of &impl AsRef<str>.
Writer::create_element
Allows passing owned strings to Writer::create_element, which is a breaking change.
Writer::create_element
Replaces Error::UnexpectedBang with SyntaxError.
Error::UnexpectedBangSyntaxError
Replaces Error::UnexpectedEof with SyntaxError in some cases.
Error::UnexpectedEofSyntaxError
Replaces Error::UnexpectedEof with IllFormedError in some cases.
Error::UnexpectedEofIllFormedError
Replaces Error::UnexpectedToken with IllFormedError::DoubleHyphenInComment.
Error::UnexpectedTokenIllFormedError::DoubleHyphenInComment
Replaces Error::XmlDeclWithoutVersion with IllFormedError::MissingDeclVersion.
Error::XmlDeclWithoutVersionIllFormedError::MissingDeclVersion
Replaces Error::EmptyDocType with IllFormedError::MissingDoctypeName.
Error::EmptyDocTypeIllFormedError::MissingDoctypeName
Stops resolving predefined entities in unescape_with methods; callers must resolve them using the provided resolve functions.
unescape_withquick_xml::escape::resolve_predefined_entityquick_xml::escape::resolve_xml_entityquick_xml::escape::resolve_html5_entity