Expand description
Post-processing document wrapper with XML/DOM, ID management, and caching.
Port of LaTeXML::Post::Document.
Wraps an XML::LibXML::Document (via the libxml crate) and provides:
- Namespace management
- ID tracking (idcache, reusable, reserved)
- XPath queries with registered namespaces
- Node manipulation (addNodes, removeNodes, cloneNode, etc.)
- Persistent cache (key-value store)
Structs§
- DocCache
- Perl’s document cache (
Post.pmL1510-1548): a key-value store per destination directory, persisted there asCACHE_FILE(kv(key, value), Perl’s keys and values) unlessnocache(Perl’s option,Post.pmL678; the cortex worker, whose every paper gets a fresh directory) or the document has no destination directory (the API): then in memory. Opened lazily, at the first lookup; every page of a run shares one (PostDocumentOptions::cache) as Perl’s split pages share their parent’s (new_internalclones it, L687-690). - Post
Document - Post-processing document: wraps an XML document with ID management, namespace tracking, XPath helpers, and a persistent cache.
- Post
Document Options - Options for creating a PostDocument.
Enums§
- Conjunction
- Conjunction for joining node lists.
- Node
Data - Recursive representation for building XML nodes.
- XMBranch
- Which branch of an
ltx:XMDualto follow — Perl’s$branchstring argument torealizeXMNode, which is only ever'content'or'presentation'.
Constants§
- CACHE_
FILE - The cache’s file name in a destination directory: Perl’s
LaTeXML.cache(Post.pmL1537) is a DB_File, which a Perl run into the same directory keeps reading, so ours, SQLite, has a name of its own. - LTX_
NSURI - The LaTeXML namespace URI.
Functions§
- element_
children - Get element children of a node (skipping text, comments, etc.).
- element_
children_ iter - Iterator version of
element_children— walks the sibling chain lazily. Prefer this in hot paths that only need to read or filter children without materializing a Vec. Callers that need len() or random access still want the Vec version. - escape_
xml - Escape a string for XML text content or a double-quoted attribute value.
- get_
xml_ id - Get the xml:id attribute value from a node. Handles both namespace-aware and plain attribute access.
- is_
cache_ file - Whether
basenameis the cache file or one of its SQLite side files, which no package carries. - kv_get
- The value under
key. - kv_put
- Store
valueunderkey(remove it forNone).