#[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
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
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
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
impl Clone for WellFormedError
Source§impl Debug for WellFormedError
impl Debug for WellFormedError
Source§impl Display for WellFormedError
impl Display for WellFormedError
impl Eq for WellFormedError
Source§impl Error for WellFormedError
impl Error for WellFormedError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<WellFormedError> for Error
impl From<WellFormedError> for Error
Source§fn from(error: WellFormedError) -> Self
fn from(error: WellFormedError) -> Self
Creates a new Error::NotWellFormed from the given error.