Skip to main content

parse

Function parse 

Source
pub fn parse(xml: &str) -> Option<Node>
Expand description

Read a document and return its root element.

This follows the oracle, which loads the document with the default parse flags and never changes them (src/stream_info_impl.cpp:183):

  • Text that holds only whitespace is dropped. captures/desc/desc_reader.txt, case whitespace_only_text.
  • A comment is dropped. Same file, case comment.
  • A line end is normalized. \r\n and a lone \r both become \n. captures/desc/desc_reparse.hex shows a carriage return that does not survive the round trip.
  • An entity reference is decoded, and a reference with no semicolon stays as it is. Same file, case unterminated_reference.