XML with comments can't be parsed
In some of my XML files there are comments like this:
<music xmlns="">
<measure number="16" width="257">
</measure>
<!--=======================================================-->
<measure number="17" width="257">
</measure>
</music>
Line number four causes an error when I try to do this:
fn main() {
let filename = "example.xml";
let contents = fs::read_to_string(filename).expect("Something went wrong reading the file");
let root: Element = contents.parse().unwrap();
}
This is the error message I get.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: NoComments', src\main.rs:154:42
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\rusty-score.exe` (exit code: 101)
I think that comments should be either ignored, or there should be an option to parse them or ignore them. What do you guys think?
I am very new to Rust, otherwise I would have loved to help you with this.