Expand description
xml-core — low-level XML infrastructure for the toolkit.
This crate provides reading and writing of generic XML streams, with no
knowledge of the OOXML vocabulary (WordprocessingML, SpreadsheetML,
PresentationML, DrawingML). It builds on quick-xml for low-level
parsing/writing; all logic specific to Office (schemas, elements,
specific attributes) lives in the higher-level crates (opc,
word-ooxml, excel-ooxml, etc.).
Structs§
- Bytes
Decl - Re-exported XML event types from
quick-xml, forming the generic XML vocabulary used throughout this crate’s public API (start/end/empty elements, text, comments, etc.). These are not specific to any Office XML vocabulary. An XML declaration (Event::Decl). - Bytes
End - Re-exported XML event types from
quick-xml, forming the generic XML vocabulary used throughout this crate’s public API (start/end/empty elements, text, comments, etc.). These are not specific to any Office XML vocabulary. Closing tag data (Event::End):</name>. - Bytes
Ref - Re-exported XML event types from
quick-xml, forming the generic XML vocabulary used throughout this crate’s public API (start/end/empty elements, text, comments, etc.). These are not specific to any Office XML vocabulary. Character or general entity reference (Event::GeneralRef):&ref;or&#<number>;. - Bytes
Start - Re-exported XML event types from
quick-xml, forming the generic XML vocabulary used throughout this crate’s public API (start/end/empty elements, text, comments, etc.). These are not specific to any Office XML vocabulary. Opening tag data (Event::Start), with optional attributes:<name attr="value">. - Bytes
Text - Re-exported XML event types from
quick-xml, forming the generic XML vocabulary used throughout this crate’s public API (start/end/empty elements, text, comments, etc.). These are not specific to any Office XML vocabulary. Data from various events (most notably,Event::Text). - Reader
- Reads a sequence of generic XML events from an in-memory UTF-8 string.
- Writer
- Writes a sequence of generic XML events to an underlying
std::io::Write.
Enums§
- Error
- Errors that can occur while reading or writing XML with
xml-core. - Event
- Re-exported XML event types from
quick-xml, forming the generic XML vocabulary used throughout this crate’s public API (start/end/empty elements, text, comments, etc.). These are not specific to any Office XML vocabulary. Event emitted byReader::read_event_into.
Functions§
- decode_
attribute_ value - Decodes an XML attribute’s raw value, undoing XML entity escaping —
mirrors
decode_textfor attribute values.quick_xml’s ownAttribute::from((&str, &str))(used throughout this toolkit’s writers viaBytesStart::push_attribute) escapes the value the exact same wayBytesText::newdoes, so this is needed for the same reason. - decode_
general_ ref - Resolves a
&entity;/&#NNN;general reference (quick_xml::events::Event::GeneralRef,BytesRef) found in text content to the character(s) it represents — seedecode_text’s doc comment for why this is a separate event fromTextinquick_xml0.41, and therefore a separate, necessary step, not an edge case. - decode_
text - Decodes an XML text event’s content: character-encoding decoding (e.g.
UTF-16 to UTF-8) via
quick_xml::events::BytesText::decode, plus a defensiveunescape()pass in case any literal&...;survived in the event’s own bytes (see below for why that’s normally not needed).