new: just parse with roxmltree

This commit is contained in:
Wataru Otsubo 2025-01-29 17:12:15 +09:00
parent 637e96b7c5
commit f64c225ea0
4 changed files with 31 additions and 0 deletions

16
Cargo.lock generated Normal file
View file

@ -0,0 +1,16 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "endcap-sl-register-interface-generator"
version = "0.1.0"
dependencies = [
"roxmltree",
]
[[package]]
name = "roxmltree"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97"

View file

@ -4,3 +4,4 @@ version = "0.1.0"
edition = "2021"
[dependencies]
roxmltree = "0.20"

1
src/lib.rs Normal file
View file

@ -0,0 +1 @@

View file

@ -1,3 +1,16 @@
use std::fs;
fn main() {
println!("Hello, world!");
let xmlfile = fs::read_to_string("./csr.xml").unwrap();
let doc = roxmltree::Document::parse_with_options(
&xmlfile,
roxmltree::ParsingOptions {
allow_dtd: true,
nodes_limit: u32::MAX,
},
)
.unwrap();
println!("Parsed: {:#?}", doc);
println!("Root: {:?}", doc.root_element());
}