aboutsummaryrefslogtreecommitdiffstats
path: root/src/parser.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser.rs')
-rw-r--r--src/parser.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/parser.rs b/src/parser.rs
index 69ead45..a75d2a1 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -125,9 +125,14 @@ pub fn parse(source: &str) -> Result<Document, Error> {
}
-/// only until we can serialize DocumentTrees
pub fn serialize_json<W>(source: &str, stream: W) -> Result<(), Error> where W: Write {
let parsed = parse(source)?;
serde_json::to_writer(stream, &parsed)?;
Ok(())
}
+
+pub fn serialize_xml<W>(source: &str, stream: W) -> Result<(), Error> where W: Write {
+ let parsed = parse(source)?;
+ serde_xml_rs::serialize(&parsed, stream)?;
+ Ok(())
+}