mirror of
https://github.com/stefanoamorelli/crabrl.git
synced 2026-04-18 15:20:49 +00:00
- Add trailing newlines to all source files - Remove extra blank lines - Simplify closure formatting in benchmarks
31 lines
655 B
Rust
31 lines
655 B
Rust
//! 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(())
|
|
}
|
|
|