1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//! Xot is an XML library that lets you access manipulate XML documents as a
//! tree in memory.
//!
//! ```rust
//! use xot::Xot;
//!
//! let mut xot = Xot::new();
//!
//! let root = xot.parse("<p>Example</p>")?;
//! let doc_el = xot.document_element(root)?;
//! let txt = xot.first_child(doc_el).unwrap();
//! let txt_value = xot.text_mut(txt).unwrap();
//! txt_value.set("Hello, world!");
//!
//! assert_eq!(xot.to_string(root)?, "<p>Hello, world!</p>");
//! # Ok::<(), xot::Error>(())
//! ```
//!
//! ## Xot approach
//!
//! Xot exposes a single [`Xot`] struct that you use to access, create and
//! manipulate all your XML data. Multiple XML trees can exist in an [`Xot`]
//! struct at the same time, and you're free to move nodes between these trees.
//!
//! [`Node`] is a lightweight handle to a node in the XML tree that you use
//! with Xot for both access and manipulation. To navigate the tree use
//! accessors such as [`Xot::first_child`] or iterators such a
//! [`Xot::children`]. You then use operations such as [`Xot::append`] to
//! manipulate the tree.
//!
//! To access and manipulate XML specific data, you use the [`Value`] for a
//! node. This is an enum that's either an [`Element`], [`Text`], [`Comment`]
//! or [`ProcessingInstruction`], [`Attribute`], [`Namespace`] or `Document`
//! (which has no value). You can use [`Xot::value`] to get the [`Value`].
//! Sometimes it's more handy to use the specific accessors for a value, such a
//! [`Xot::element`] or [`Xot::text`].
//!
//! XML names and namespaces in Xot are referenced by ids. In order to
//! construct or compare an element, you first need to get hold of a name. To
//! access a name, use [`Xot::name`]. To create a new name if necessary, use
//! [`Xot::add_name`]. To construct a name with a namespace, use
//! [`Xot::add_namespace`] and then [`Xot::add_name_ns`]. To create a namespace
//! prefix, use [`Xot::add_prefix`]. You can also use the [`xmlname`] module to
//! manage names; see [`xmlname::CreateName`] for a bunch of convenient ways to
//! create names, for instance.
//!
//! Attributes and namespace access is most conveniently done through the
//! [`Xot::attributes`] and [`Xot::namespaces`] accessors. Manipulation is most
//! conveniently done through their mutable variants [`Xot::attributes_mut`]
//! and [`Xot::namespaces_mut`].
//!
//! In some cases however you may want to be able to create namespace and
//! attribute nodes directly. This can be done through the
//! [`Xot::new_namespace_node`] and [`Xot::new_attribute_node`] APIs.
//!
//! You can also create Xot nodes from a fixed structure, the [`fixed`]
//! submodule.
pub use ;
pub use ;
pub use ;
pub use LevelOrder;
pub use ;
pub use ;
pub use Html5;
pub use ;
pub use ;