Skip to main content

XmlDoc

Struct XmlDoc 

Source
pub struct XmlDoc {
    pub version: String,
    pub encoding: Option<String>,
    pub standalone: Option<bool>,
    pub dtd: Option<XmlDtd>,
    /* private fields */
}
Expand description

libxml2 xmlDoc.

Fields§

§version: String

XML version string; default "1.0".

§encoding: Option<String>

Encoding name from the XML declaration, if any.

§standalone: Option<bool>

Some(true/false) from standalone, None if omitted.

§dtd: Option<XmlDtd>

Internal / attached DTD, if any.

Implementations§

Source§

impl XmlDoc

Source

pub fn xml_new_doc(version: Option<&str>) -> Self

xmlNewDoc.

Source

pub fn node(&self, id: NodeId) -> &Node

Source

pub fn node_mut(&mut self, id: NodeId) -> &mut Node

Source

pub fn kind(&self, id: NodeId) -> NodeKind

Source

pub fn name(&self, id: NodeId) -> &str

Source

pub fn prefix(&self, id: NodeId) -> Option<&str>

Source

pub fn ns_uri(&self, id: NodeId) -> Option<&str>

Source

pub fn content(&self, id: NodeId) -> &str

Source

pub fn parent(&self, id: NodeId) -> Option<NodeId>

Source

pub fn first_child(&self, id: NodeId) -> Option<NodeId>

Source

pub fn last_child(&self, id: NodeId) -> Option<NodeId>

Source

pub fn next_sibling(&self, id: NodeId) -> Option<NodeId>

Source

pub fn prev_sibling(&self, id: NodeId) -> Option<NodeId>

Source

pub fn first_attr(&self, id: NodeId) -> Option<NodeId>

Source

pub fn ns_defs(&self, id: NodeId) -> &[(Option<String>, String)]

Source

pub fn alloc(&mut self, kind: NodeKind, name: impl Into<String>) -> NodeId

Source

pub fn xml_doc_get_root_element(&self) -> Option<NodeId>

xmlDocGetRootElement.

Source

pub fn xml_doc_set_root_element(&mut self, elem: NodeId) -> Option<NodeId>

xmlDocSetRootElement. Returns the previous root, if any.

Source

pub fn xml_new_node(&mut self, ns_uri: Option<&str>, name: &str) -> NodeId

xmlNewNode.

Source

pub fn xml_new_doc_node( &mut self, ns_uri: Option<&str>, name: &str, content: Option<&str>, ) -> NodeId

xmlNewDocNode.

Source

pub fn xml_new_child( &mut self, parent: NodeId, ns_uri: Option<&str>, name: &str, content: Option<&str>, ) -> NodeId

xmlNewChild.

Source

pub fn xml_add_child(&mut self, parent: NodeId, child: NodeId)

xmlAddChild.

Source

pub fn xml_add_next_sibling(&mut self, cur: NodeId, elem: NodeId)

xmlAddNextSibling.

Source

pub fn xml_add_prev_sibling(&mut self, cur: NodeId, elem: NodeId)

xmlAddPrevSibling.

xmlUnlinkNode.

Source

pub fn xml_replace_node(&mut self, old: NodeId, new: NodeId) -> NodeId

xmlReplaceNode.

Source

pub fn add_attr( &mut self, elem: NodeId, name: &str, prefix: Option<&str>, value: &str, ) -> NodeId

Source

pub fn push_ns_def(&mut self, elem: NodeId, prefix: Option<String>, uri: String)

Source

pub fn xml_set_prop(&mut self, node: NodeId, name: &str, value: &str) -> NodeId

xmlSetProp.

Source

pub fn xml_get_prop(&self, node: NodeId, name: &str) -> Option<String>

xmlGetProp.

Source

pub fn xml_has_prop(&self, node: NodeId, name: &str) -> bool

xmlHasProp.

Source

pub fn xml_unset_prop(&mut self, node: NodeId, name: &str) -> bool

xmlUnsetProp.

Source

pub fn xml_node_get_content(&self, id: NodeId) -> String

xmlNodeGetContent — concatenate descendant text/CDATA.

Source

pub fn xml_node_set_content(&mut self, id: NodeId, content: &str)

xmlNodeSetContent — replace children with a single text node.

Source

pub fn xml_is_blank_node(&self, id: NodeId) -> bool

xmlIsBlankNode.

Source

pub fn xml_search_ns( &self, node: NodeId, prefix: Option<&str>, ) -> Option<String>

xmlSearchNs — walk ancestors for a prefix binding.

Source

pub fn xml_new_ns(&mut self, node: NodeId, href: &str, prefix: Option<&str>)

xmlNewNs — add a namespace declaration on an element.

Source

pub fn xml_set_ns( &mut self, node: NodeId, href: Option<&str>, prefix: Option<&str>, )

xmlSetNs.

Source

pub fn xml_copy_doc(&self) -> XmlDoc

xmlCopyDoc — deep copy.

Source

pub fn qname(&self, id: NodeId) -> String

Source

pub fn children(&self, id: NodeId) -> NodeIter<'_>

Source

pub fn attrs(&self, id: NodeId) -> NodeIter<'_>

Source

pub fn len(&self) -> usize

Trait Implementations§

Source§

impl Clone for XmlDoc

Source§

fn clone(&self) -> XmlDoc

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for XmlDoc

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for XmlDoc

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.