Skip to main content

WellFormedError

Enum WellFormedError 

Source
#[non_exhaustive]
pub enum WellFormedError {
Show 24 variants InvalidCharacter(char), InvalidName(String), InvalidPublicId(String), InvalidReference(String), UndeclaredEntity(String), RecursiveEntity(String), EntityExpansionLimit { entity: String, limit: &'static str, }, UnparsedEntityReference(String), IllFormedEntity { entity: String, reason: String, }, LessThanInAttributeValue(String), ExternalEntityInAttributeValue(String), DuplicateAttribute(String), InvalidQName(String), EmptyPrefixBinding(String), MalformedTag(String), CDataEndInContent, ReservedPiTarget(String), MisplacedXmlDeclaration, InvalidXmlDeclaration(String), MisplacedDoctype, MissingRootElement, MultipleRootElements, ContentOutsideRoot, InvalidDoctype(String),
}
Expand description

A violation of an XML well-formedness constraint that is reported only when Config::check_well_formedness is enabled.

The default parsing path of this crate is deliberately permissive so that it stays a drop-in replacement for quick-xml; enabling the flag turns the Reader into a conforming non-validating XML processor and these errors become observable.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

InvalidCharacter(char)

A character that the Char production of the document’s XML version does not allow was found.

§

InvalidName(String)

A token that must match the Name production does not.

§

InvalidPublicId(String)

A public identifier contains a character outside the PubidChar production.

§

InvalidReference(String)

A &...; entity or character reference does not match the Reference production, or a character reference denotes a code point that is not a legal XML character.

§

UndeclaredEntity(String)

A general entity was referenced but never declared, violating the Entity Declared constraint.

§

RecursiveEntity(String)

A general entity refers to itself, directly or indirectly, violating the No Recursion constraint.

§

EntityExpansionLimit

Expanding general entities exceeded the limits this processor imposes on the total number of expansions or on the total size of the expanded text.

Entity expansion is not recursive in the sense of the No Recursion constraint when every entity has a different name, yet a document such as the “billion laughs” bomb can still expand exponentially. Since a non-validating processor is not required to expand entities without bound, such a document is rejected instead of being expanded.

Fields

§entity: String

Name of the entity whose expansion exhausted the budget.

§limit: &'static str

Description of the limit that was hit.

§

UnparsedEntityReference(String)

An unparsed (NDATA) entity was referenced from content or from an attribute value, violating the Parsed Entity constraint.

§

IllFormedEntity

The replacement text of a general entity is not well-formed on its own, violating the [Legal Character] / balanced-markup constraints. Contains the entity name and the nested failure.

Fields

§entity: String

Name of the entity whose replacement text is at fault.

§reason: String

Description of the problem found inside the replacement text.

§

LessThanInAttributeValue(String)

An attribute value contains a literal <, violating the No < in Attribute Values constraint. Contains the attribute name.

§

ExternalEntityInAttributeValue(String)

An attribute value refers, directly or indirectly, to an external entity, violating the No External Entity References constraint.

§

DuplicateAttribute(String)

The same attribute name appears twice on one tag, violating the Unique Att Spec constraint.

§

InvalidQName(String)

A name does not match the QName production of Namespaces in XML, or a name that must be an NCName contains a colon. Only reported while namespace processing is active, that is for the NsReader.

§

EmptyPrefixBinding(String)

A namespace declaration binds a prefix to the empty namespace name, which Namespaces in XML 1.0 does not allow.

§

MalformedTag(String)

A start, end or empty-element tag does not match the STag production. Contains a description of the expectation that was violated.

§

CDataEndInContent

Character data contains the ]]> sequence outside of a CDATA section.

§

ReservedPiTarget(String)

A processing instruction uses the reserved target xml (in any case combination).

§

MisplacedXmlDeclaration

An XML declaration was found somewhere other than at the very beginning of the document entity.

§

InvalidXmlDeclaration(String)

The XML declaration does not match the XMLDecl production. Contains a description of the expectation that was violated.

§

MisplacedDoctype

A <!DOCTYPE> declaration appears after the root element started, or a second one appears.

§

MissingRootElement

The document contains no root element.

§

MultipleRootElements

A second top-level element was found after the root element was closed.

§

ContentOutsideRoot

Character data, a CDATA section or an entity reference was found outside of the root element.

§

InvalidDoctype(String)

The document type declaration does not match the doctypedecl production. Contains a description of the expectation that was violated.

Trait Implementations§

Source§

impl Clone for WellFormedError

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WellFormedError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for WellFormedError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for WellFormedError

Source§

impl Error for WellFormedError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<WellFormedError> for Error

Source§

fn from(error: WellFormedError) -> Self

Creates a new Error::NotWellFormed from the given error.

Source§

impl PartialEq for WellFormedError

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for WellFormedError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.