MCPcopy Index your code
hub / github.com/faassen/xot

github.com/faassen/xot @v0.31.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.31.2 ↗ · + Follow
867 symbols 4,016 edges 57 files 225 documented · 26%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Xot - XML Object Tree

Crates.io Documentation

Xot is a full-featured XML tree access and manipulation library for Rust. With Xot you can load XML data into an object tree which you can then manipulate, and serialize back out to XML.

API Documentation

Features

  • Extensive XML tree access and manipulation API.

  • You can access the parent of a node! A lot of Rust XML tree libraries do not support this features: xmltree-rs, RustyXML, minidom and elementtree all lack this ability for instance. roxmltree does allow parent access, but is read-only.

  • Move nodes out of trees, into trees, into other trees with ease.

  • Access to the entire XML structure, including comments and processing instructions, and support for namespace and attribute nodes.

  • Compact storage of XML data, with efficient traversal.

  • Parse XML into a tree, and serialize back to XML.

  • Pretty-printing. Removal of non-significant whitespace.

Support

Xot has well-rounded XML support. Supported are namespaces for both elements and attributes. You can also get comments and processing instructions.

Xot exposes the entire XML structure for access and programmatic manipulation.

Limitations

There are the following limitations:

  • DTDs are not supported.
  • Only XML 1.0 is supported.

Why another XML library for Rust?

Use Xot if you need to be able to access XML as a tree, mutate it where necessary, and serialize it back out again. Various Rust XML tree libraries exist but none seem particularly interested in a complete tree manipulation API, including parent access, so Xot aims to fill that gap.

If you need to access XML as a tree, very high performance, and do not need tree manipulation or serialization at all, I recommend roxmltree.

For extensive features such as Xpath as well as tree manipulation, you can use libxml which wraps the libxml2 C library. Unfortunately its tree access facilities aren't entirely complete, and I've experienced odd errors and even crashes when using it; this was part of the reason I created Xot.

If you need to process big XML data with high performance, you may not want to use a tree library and instead use one of the various XML parser/serialization libraries.

Implementation notes

Xot underneath uses the indextree crate. Xot completely wraps the indextree functionality but the various operations it allows are taken from indextree.

Extension points exported contracts — how you extend this code

NameStrInfo (Interface)
Name string information for an xml name. [2 implementers]
src/xmlname/reference.rs
IdIndex (Interface)
(no doc) [4 implementers]
src/id/idmap.rs
Normalizer (Interface)
(no doc) [3 implementers]
src/output/normalizer.rs
ValueAdapter (Interface)
(no doc) [2 implementers]
src/nodemap/core.rs

Core symbols most depended-on inside this repo

parse
called by 286
src/parse.rs
document_element
called by 173
src/access.rs
to_string
called by 161
src/serialize.rs
first_child
called by 147
src/access.rs
get
called by 97
src/parse.rs
next_sibling
called by 60
src/access.rs
push
called by 58
src/output/fullname.rs
add_namespace
called by 56
src/nameaccess.rs

Shape

Function 399
Method 391
Class 56
Enum 17
Interface 4

Languages

Rust100%

Modules by API surface

tests/test_manip.rs67 symbols
src/access.rs57 symbols
src/entity.rs46 symbols
tests/test_parser.rs44 symbols
src/output/html5_serializer.rs43 symbols
src/nameaccess.rs43 symbols
src/valueaccess.rs40 symbols
src/parse.rs39 symbols
src/nodemap/core.rs34 symbols
src/manipulation.rs33 symbols
src/xmlvalue.rs28 symbols
src/output/fullname.rs28 symbols

For agents

$ claude mcp add xot \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact