pub struct StringXmlWriter { /* private fields */ }Expand description
A string-based XML writer for convenience.
Implementations§
Source§impl StringXmlWriter
impl StringXmlWriter
Sourcepub fn with_indent(indent: IndentConfig) -> Self
pub fn with_indent(indent: IndentConfig) -> Self
Creates a new string-based XML writer with indentation.
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Consumes the writer and returns the XML string.
Methods from Deref<Target = XmlWriter<Vec<u8>>>§
Sourcepub fn write_declaration(
&mut self,
version: &str,
encoding: Option<&str>,
) -> Result<()>
pub fn write_declaration( &mut self, version: &str, encoding: Option<&str>, ) -> Result<()>
Writes the XML declaration.
Sourcepub fn start_element(&mut self, name: &str) -> Result<()>
pub fn start_element(&mut self, name: &str) -> Result<()>
Starts an element.
Sourcepub fn write_attribute(&mut self, name: &str, value: &str) -> Result<()>
pub fn write_attribute(&mut self, name: &str, value: &str) -> Result<()>
Writes an attribute for the current element.
Sourcepub fn end_element(&mut self) -> Result<()>
pub fn end_element(&mut self) -> Result<()>
Ends the current element.
Sourcepub fn write_text(&mut self, text: &str) -> Result<()>
pub fn write_text(&mut self, text: &str) -> Result<()>
Writes text content.
Sourcepub fn write_cdata(&mut self, data: &str) -> Result<()>
pub fn write_cdata(&mut self, data: &str) -> Result<()>
Writes a CDATA section.
Sourcepub fn write_comment(&mut self, comment: &str) -> Result<()>
pub fn write_comment(&mut self, comment: &str) -> Result<()>
Writes a comment.
Sourcepub fn write_pi(&mut self, target: &str, data: Option<&str>) -> Result<()>
pub fn write_pi(&mut self, target: &str, data: Option<&str>) -> Result<()>
Writes a processing instruction.
Sourcepub fn write_element(&mut self, name: &str, content: &str) -> Result<()>
pub fn write_element(&mut self, name: &str, content: &str) -> Result<()>
Writes a complete element with text content.
Sourcepub fn write_empty_element(&mut self, name: &str) -> Result<()>
pub fn write_empty_element(&mut self, name: &str) -> Result<()>
Writes an empty element.
Trait Implementations§
Source§impl Default for StringXmlWriter
impl Default for StringXmlWriter
Source§impl Deref for StringXmlWriter
impl Deref for StringXmlWriter
Auto Trait Implementations§
impl Freeze for StringXmlWriter
impl RefUnwindSafe for StringXmlWriter
impl Send for StringXmlWriter
impl Sync for StringXmlWriter
impl Unpin for StringXmlWriter
impl UnwindSafe for StringXmlWriter
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