Skip to content

Commit 3129085

Browse files
committed
cameras.xml xmllint
1 parent dcf5fe5 commit 3129085

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/metadata/camerasxml_parser/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ rawspeed-metadata-xmlparser = { path = "../xmlparser" }
1919

2020
[lib]
2121
path = "mod.rs"
22+
23+
[[bin]]
24+
name = "xmllint"
25+
path = "xmllint.rs"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use rawspeed_metadata_camerasxml_parser::camerasxml_parser;
2+
use std::env;
3+
use std::fs;
4+
5+
#[expect(clippy::print_stdout, clippy::use_debug)]
6+
fn main() -> Result<(), Box<dyn core::error::Error>> {
7+
let args: Vec<String> = env::args().collect();
8+
9+
let file_path = match args.get(2) {
10+
Some(p) => p,
11+
None => "/home/lebedevri/rawspeed/data/cameras.xml",
12+
};
13+
14+
println!("In file {file_path}");
15+
16+
let contents = fs::read_to_string(file_path)
17+
.expect("Should have been able to read the file");
18+
19+
let repr = camerasxml_parser::parse_str(&contents)?;
20+
println!("{repr:#?}");
21+
Ok(())
22+
}

0 commit comments

Comments
 (0)