feat(taxonomy): add rust sidecar compact surface pipeline
This commit is contained in:
29
rust/vendor/crabrl/examples/validate.rs
vendored
Normal file
29
rust/vendor/crabrl/examples/validate.rs
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
//! Validation example
|
||||
|
||||
use crabrl::{Parser, Validator};
|
||||
use std::env;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let args: Vec<String> = env::args().collect();
|
||||
if args.len() != 2 {
|
||||
eprintln!("Usage: {} <xbrl-file>", args[0]);
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
// Parse
|
||||
let parser = Parser::new();
|
||||
let doc = parser.parse_file(&args[1])?;
|
||||
|
||||
// Validate
|
||||
let validator = Validator::new();
|
||||
match validator.validate(&doc) {
|
||||
Ok(_) => {
|
||||
println!("✓ Document is valid");
|
||||
}
|
||||
Err(e) => {
|
||||
println!("✗ Validation failed: {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user