pub struct Document { /* private fields */ }Expand description
XML document represented as a typed tree backed by node IDs.
Implementations§
Source§impl Document
impl Document
pub fn new() -> Self
pub fn root(&self) -> Option<NodeId>
pub fn namespaces(&self) -> &NamespaceTable
pub fn namespaces_mut(&mut self) -> &mut NamespaceTable
pub fn node(&self, id: NodeId) -> XmlResult<&Node>
pub fn parent(&self, id: NodeId) -> XmlResult<Option<NodeId>>
pub fn children(&self, id: NodeId) -> XmlResult<&[NodeId]>
pub fn add_root_element(&mut self, name: QName) -> XmlResult<NodeId>
pub fn add_element(&mut self, parent: NodeId, name: QName) -> XmlResult<NodeId>
pub fn add_text( &mut self, parent: NodeId, text: impl Into<String>, ) -> XmlResult<NodeId>
pub fn add_comment( &mut self, parent: NodeId, text: impl Into<String>, ) -> XmlResult<NodeId>
pub fn add_cdata( &mut self, parent: NodeId, text: impl Into<String>, ) -> XmlResult<NodeId>
pub fn add_processing_instruction( &mut self, parent: NodeId, target: impl Into<String>, data: Option<impl Into<String>>, ) -> XmlResult<NodeId>
pub fn add_attribute( &mut self, element: NodeId, attribute: Attribute, ) -> XmlResult<()>
pub fn add_namespace_declaration( &mut self, element: NodeId, declaration: NamespaceDeclaration, ) -> XmlResult<()>
pub fn path(&self, id: NodeId) -> XmlResult<XmlPath>
Trait Implementations§
Source§impl DocumentQueryExt for Document
impl DocumentQueryExt for Document
fn query(&self, source: &str) -> XmlResult<QueryResult>
fn query_with_context( &self, source: &str, namespaces: &NamespaceContext, ) -> XmlResult<QueryResult>
impl Eq for Document
impl StructuralPartialEq for Document
Auto Trait Implementations§
impl Freeze for Document
impl RefUnwindSafe for Document
impl Send for Document
impl Sync for Document
impl Unpin for Document
impl UnsafeUnpin for Document
impl UnwindSafe for Document
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