Last active
April 19, 2020 07:01
-
-
Save fredrik-jansson-se/ee562354fbde5ac8b8329f81ffc5c07a to your computer and use it in GitHub Desktop.
Quick XML extra Text
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use quick_xml::{events::Event, Reader}; | |
fn main() { | |
const BASE1_1: &str = "urn:ietf:params:netconf:base:1.1"; | |
let xml = format!("<capability>{}</capability>", BASE1_1); | |
let mut r = Reader::from_str(&xml); | |
let mut buf = Vec::new(); | |
loop { | |
let ev = r.read_event(&mut buf); | |
println!("event: {:?}", ev); | |
if let Ok(Event::Eof) = ev { | |
break; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Parsing xml: '<capability>urn:ietf:params:netconf:base:1.1</capability>' | |
event: Ok(Text(BytesText { content: "" })) | |
event: Ok(Start(BytesStart { buf: "capability", name_len: 10 })) | |
event: Ok(Text(BytesText { content: "urn:ietf:params:netconf:base:1.1" })) | |
event: Ok(End(BytesEnd { name: "capability" })) | |
event: Ok(Eof) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment