Skip to main content

Module xml

Module xml 

Source

Structs§

ParsedFragment
A parsed markup chunk, bundled with the throwaway document that owns it.
XPath

Constants§

XMLNS_NS
XML_NS

Functions§

closest_element
content_nodes
obtains all content children of node (Element and Text), ignoring all other node types
detached_root
Walk node’s ancestor chain to the top. If the chain ends at a Document (or document-fragment) node the subtree is LIVE — part of a document tree — and None is returned; otherwise the topmost node is a DETACHED root and is returned. Callers use this to decide whether a source tree they are done with is theirs to free (Document::discard_subtree) or still reachable from a live document.
element_nodes
obtains all Element children of node, ignoring all other node types
get_next_element
gets the following Element sibling of node (skipping over non-element nodes)
get_prev_element
gets the previous Element sibling of node (skipping over non-element nodes)
is_descendant_or_self
Is child the same as parent, or a descendent of parent?
is_parse_artifact
Is node an artifact of HOW a chunk was parsed, rather than part of the chunk? True for exactly the two things that can sit ABOVE a chunk’s top-level nodes: the throwaway parse_fragment wrapper, and the parsed document node.
parse_chunk
Parse a standalone markup string into its own document — the port of Perl LaTeXML::Common::XML::Parser::parseChunk (Common/XML/Parser.pm:36-39: parse_string($string) then ->documentElement, “expects only a single node”). Parsing lives here, beside the rest of the Common::XML helpers, and NOT in Document — mirroring Perl, where Document::appendTree only ever consumes already-parsed nodes.
parse_fragment
Parse a markup chunk that may be a document FRAGMENT — several sibling nodes, or bare text — and return its owning document together with the top-level nodes to insert. Returning the two together is deliberate: libxml Nodes are handles into the document that owns them, so the caller must keep the [Document] alive for exactly as long as it uses the nodes.