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
impl Parser
sourcepub fn default_html() -> Self
pub fn default_html() -> Self
Create a parser for HTML documents
sourcepub fn parse_file(&self, filename: &str) -> Result<Document, XmlParseError>
pub fn parse_file(&self, filename: &str) -> Result<Document, XmlParseError>
Parses the XML/HTML file filename
to generate a new Document
sourcepub fn parse_file_with_options(
&self,
filename: &str,
parser_options: ParserOptions<'_>
) -> Result<Document, XmlParseError>
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
sourcepub fn parse_string<Bytes: AsRef<[u8]>>(
&self,
input: Bytes
) -> Result<Document, XmlParseError>
pub fn parse_string<Bytes: AsRef<[u8]>>( &self, input: Bytes ) -> Result<Document, XmlParseError>
Parses the XML/HTML bytes input
to generate a new Document
sourcepub fn parse_string_with_options<Bytes: AsRef<[u8]>>(
&self,
input: Bytes,
parser_options: ParserOptions<'_>
) -> Result<Document, XmlParseError>
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
sourcepub fn is_well_formed_html<Bytes: AsRef<[u8]>>(&self, input: Bytes) -> bool
pub fn is_well_formed_html<Bytes: AsRef<[u8]>>(&self, input: Bytes) -> bool
Checks a string for well-formedness.
sourcepub fn is_well_formed_html_with_encoding<Bytes: AsRef<[u8]>>(
&self,
input: Bytes,
encoding: Option<&str>
) -> bool
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
Help is welcome in implementing it correctly.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Parser
impl Send for Parser
impl Sync for Parser
impl Unpin for Parser
impl UnwindSafe for Parser
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more