pub struct XmlTree<'a> { /* private fields */ }Expand description
An XML document built into a parsec-web tree: its elements are
Ns::Xml with their names as written, its attributes’ namespaces are
AttrNs::Host ids, and names holds what those ids stand for. The
host keeps namespace declarations out of the attributes.
Implementations§
Trait Implementations§
impl<'a> Copy for XmlTree<'a>
Source§impl Tree for XmlTree<'_>
impl Tree for XmlTree<'_>
fn kind(&self, n: NodeId) -> NodeType
fn parent(&self, n: NodeId) -> Option<NodeId>
fn first_child(&self, n: NodeId) -> Option<NodeId>
fn next_sibling(&self, n: NodeId) -> Option<NodeId>
fn prev_sibling(&self, n: NodeId) -> Option<NodeId>
Source§fn qualified_name(&self, n: NodeId) -> &str
fn qualified_name(&self, n: NodeId) -> &str
An element’s name as written, with any prefix: what
name()
gives. Lowercase in HTML.Source§fn local_name(&self, n: NodeId) -> &str
fn local_name(&self, n: NodeId) -> &str
An element’s name without its prefix: what
local-name() gives.Source§fn namespace_uri(&self, n: NodeId) -> &str
fn namespace_uri(&self, n: NodeId) -> &str
An element’s namespace URI; “” for no namespace.
Source§fn attribute_count(&self, n: NodeId) -> u32
fn attribute_count(&self, n: NodeId) -> u32
How many attributes an element has. In XPath’s data model,
xmlns and xmlns:* are namespace nodes rather than attributes, so
an XML tree leaves them out of these. An HTML tree keeps them, as
libxml2’s HTML parser does.Source§fn attribute(&self, n: NodeId, i: u32) -> Option<Attr<'_>>
fn attribute(&self, n: NodeId, i: u32) -> Option<Attr<'_>>
An element’s
ith attribute, in document order. A query reads
attributes by place, so this should take constant time.Source§fn namespace_declaration_count(&self, n: NodeId) -> u32
fn namespace_declaration_count(&self, n: NodeId) -> u32
How many namespaces node
n declares: an XML element’s xmlns
and xmlns:* attributes. A root that isn’t an element may declare
the namespaces in scope where its tree was cut from, which its
elements then inherit. The namespace axis works out what’s in scope
from these. None by default, as an HTML tree has none: its elements
have only the xml namespace, which is always in scope.Source§fn namespace_declaration(&self, n: NodeId, i: u32) -> Option<(&str, &str)>
fn namespace_declaration(&self, n: NodeId, i: u32) -> Option<(&str, &str)>
Node
n’s ith declaration, in the order written: the prefix (“”
for the default namespace) and the URI (“” for xmlns="", which
takes the binding away). Of two for one prefix on a node, the
first counts. This should take constant time.Source§fn data(&self, n: NodeId) -> &str
fn data(&self, n: NodeId) -> &str
A text, CDATA section, comment or processing instruction’s text.
Source§fn is_xml(&self) -> bool
fn is_xml(&self) -> bool
Whether names compare exactly (XML), rather than ignoring ASCII
case with prefixes left as part of the name (HTML).
Source§fn id(&self, n: NodeId) -> Option<&str>
fn id(&self, n: NodeId) -> Option<&str>
The value
id() finds an element by: HTML’s id, or XML’s
xml:id or an attribute the DTD declares an ID.Source§fn lang(&self, n: NodeId) -> Option<&str>
fn lang(&self, n: NodeId) -> Option<&str>
The language an element declares, if it declares one, for
lang(): xml:lang, or HTML’s lang.fn is_empty(&self) -> bool
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for XmlTree<'a>
impl<'a> !UnwindSafe for XmlTree<'a>
impl<'a> Forget for XmlTree<'a>
impl<'a> Freeze for XmlTree<'a>
impl<'a> Move for XmlTree<'a>
impl<'a> Send for XmlTree<'a>
impl<'a> Sync for XmlTree<'a>
impl<'a> Unpin for XmlTree<'a>
impl<'a> UnsafeUnpin for XmlTree<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more