[−][src]Struct simple_xml::Node
Fields
tag: String
attributes: HashMap<String, String>
content: String
Implementations
impl Node
[src]
pub fn get_nodes(&self, tag: &str) -> Option<&Vec<Node>>
[src]
Returns a list of all nodes with the specified tag If no nodes with the specified tag exists, None is returned
pub fn try_get_nodes(&self, tag: &str) -> Result<&Vec<Node>, Error>
[src]
Returns a list of all nodes with the specified tag If no nodes with the specified tag exists, an Err of TagNotFound is returned containing the parent name and requested node name Otherwise, works exactly like get_nodes but can be chained with ? (try operator)
pub fn add_attribute(&mut self, key: &str, val: &str) -> Option<String>
[src]
Adds or updates an attribute If an attribute with that key already exists it is returned
pub fn get_attribute(&self, key: &str) -> Option<&String>
[src]
pub fn try_get_attribute(&self, key: &str) -> Result<&String, Error>
[src]
Gets an attribute by name or returns an Err of AttributeNotFound containing the parent tag and the requested key Otherwise, works exactly like get_nodes but can be chained with ? (try operator)
pub fn add_node(&mut self, node: Node)
[src]
Inserts a new node node with the name of the node field
pub fn add_new_node(&mut self, tag: &str, content: String)
[src]
Inserts a new node into the xml structure Does the same thing as node.add_node(simple_xml::new(tag, content));
pub fn save_to_file<P: AsRef<Path>>(&self, path: P) -> Result<()>
[src]
This writes an xml structure to a file specified by path Uses the non-pretty to_string formatting
pub fn save_to_file_pretty<P: AsRef<Path>>(&self, path: P) -> Result<()>
[src]
This writes an xml structure to a file specified by path Uses the pretty to_string_pretty formatting
pub fn to_string_pretty(&self) -> String
[src]
Trait Implementations
impl Debug for Node
[src]
impl Display for Node
[src]
impl<'_> Index<&'_ str> for Node
[src]
Returns a slice of all node nodes with the specified tag If no nodes with the specified tag exists, an empty slice is returned
Auto Trait Implementations
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnwindSafe for Node
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,