Skip to main content

Crate f_office_xml

Crate f_office_xml 

Source
Expand description

XML tree for Office Open XML parts.

The tree keeps every element, attribute, namespace prefix and comment, and the markup that no format crate reads, including mc:AlternateContent, so that a format crate reads what it knows and passes over the rest. It is not lossless, and nothing writes it back: text takes XML’s normalization of line ends, with its character and entity references resolved and its CDATA sections joined to it; attribute values take XML’s attribute-value normalization; and the XML declaration and processing instructions keep only their place. Each node keeps where its markup lies in the parsed bytes (Document::span), so that an edit replaces those bytes and keeps every other byte of the part; new XML for an edit is parsed with the namespace declarations of its place (Document::parse_fragment), and two nodes compare as written or by meaning (Document::same_tree). Typed views in the format crates read from this tree. The reader refuses a DOCTYPE and limits the nesting depth and the number of nodes. A namespace prefix without a declaration does not stop the reader: the tree lists it (Document::undeclared_prefixes), so that a format crate can warn of it. The tables of the enumerations (enumeration) are the names that the format crates read the values of such a type through.

Modules§

enumeration
The tables of the enumerations of Office Open XML: the simple types whose values are a list of names, such as ST_Jc and ST_HeightRule. Each type that a place reads is a table of all its names (Values), each with the case that F-Office reads it as and how F-Office draws it (Case, Drawn). The table stands beside the type of its cases in the format crate, and the format crate’s reader reads a value through it and gives its own warnings: a name that F-Office draws as another value’s case, and any other text, which counts as missing.

Structs§

Attribute
One attribute of an element borrowed from a Document’s arena.
Attrs
Zero-copy view of an element’s attributes stored contiguously in a Document’s arena.
AttrsIter
Iterator over an element’s attributes in document order (Attrs::iter).
Document
A parsed XML part stored in flat contiguous arenas (nodes, child indices, attributes, and a single UTF-8 string buffer with interned tag and attribute names).
Element
An element with its attributes, borrowed zero-copy from a Document’s arena.
Fragment
XML parsed as the content of an element of another document (Document::parse_fragment): a document whose nodes stand for the fragment’s, in order.
Limits
Limits that protect the reader against hostile input. Start from Limits::default and set the limits that differ, so that a new limit breaks no caller.
Name
An element or attribute name borrowed from a Document’s string arena.
NamespaceId
A namespace URI interned in a Document.
NodeId
A node in a Document.
StreamedBody
Index of a WordprocessingML main document part produced by scan_body_children.

Enums§

Equality
How Document::same_tree compares two nodes. Both compare text, comments and processing instructions exactly, as the reader holds them, and the children in order.
Error
Why a part could not be read, or a node’s span or a fragment not given.
NodeKind
What a node holds, borrowed zero-copy from a Document’s arena.

Functions§

scan_body_children
Scans bytes in a single streaming pass without constructing an XML DOM and returns the exact byte ranges of every direct child element of <w:body> (when bytes is UTF-8 and contains a <w:document> / <w:body> in one of w_namespaces).