Struct libxml::parser::Parser

source ·
pub struct Parser {
    pub format: ParseFormat,
}
Expand description

Parsing API wrapper for libxml2

Fields§

§format: ParseFormat

The ParseFormat for this parser

Implementations§

source§

impl Parser

source

pub fn default_html() -> Self

Create a parser for HTML documents

source

pub fn parse_file(&self, filename: &str) -> Result<Document, XmlParseError>

Parses the XML/HTML file filename to generate a new Document

source

pub fn parse_file_with_options( &self, filename: &str, parser_options: ParserOptions<'_> ) -> Result<Document, XmlParseError>

Parses the XML/HTML file filename with a manually-specified parser-options to generate a new Document

source

pub fn parse_string<Bytes: AsRef<[u8]>>( &self, input: Bytes ) -> Result<Document, XmlParseError>

Parses the XML/HTML bytes input to generate a new Document

source

pub fn parse_string_with_options<Bytes: AsRef<[u8]>>( &self, input: Bytes, parser_options: ParserOptions<'_> ) -> Result<Document, XmlParseError>

Parses the XML/HTML bytes input with a manually-specified parser-options to generate a new Document

source

pub fn is_well_formed_html<Bytes: AsRef<[u8]>>(&self, input: Bytes) -> bool

Checks a string for well-formedness.

source

pub fn is_well_formed_html_with_encoding<Bytes: AsRef<[u8]>>( &self, input: Bytes, encoding: Option<&str> ) -> bool

Checks a string for well-formedness with manually-specified encoding. IMPORTANT: This function is currently implemented in a HACKY way, to ignore invalid errors for HTML5 elements (such as ) this means you should NEVER USE IT WHILE THREADING, it is CERTAIN TO BREAK

Help is welcome in implementing it correctly.

Trait Implementations§

source§

impl Default for Parser

source§

fn default() -> Self

Create a parser for XML documents

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.