# Pretty printing in compact form perl -MXML::Twig -MText::Wrap -e 'package Text::Wrap; $columns=78; $huge="overflow"; XML::Twig->new(pretty_print=>"indented_c")->parse(\*STDIN)->print;' # Pretty printing with attributes in separate lines (VCS-friendly) perl -MXML::Twig -MText::Wrap -e 'package Text::Wrap; $columns=78; $huge="overflow"; XML::Twig->new(pretty_print=>"indented_a")->parse(\*STDIN)->print;' # XSD 2 example XML perl -MXML::Compile::Schema -le '$r=shift @ARGV; $s=XML::Compile::Schema->new; $s->importDefinitions($_) for @ARGV; print $s->template("XML", $r, show=>"ALL")' '{http://some.name.space/}rootTag' *.xsd # XSD 2 example YAML perl -MYAML -MXML::Compile::Schema -le '$r=shift @ARGV; $s=XML::Compile::Schema->new; $s->importDefinitions($_) for @ARGV; print Dump eval $s->template("PERL", $r, show=>"ALL")' # XML to YAML perl -MYAML -MXML::Compile::Schema -MXML::Compile::Util=type_of_node -le '$x=XML::LibXML->new->parse_fh(\*STDIN); $r=$x->documentElement; print Dump (XML::Compile::Schema->new(\@ARGV)->compile(READER=>type_of_node($r), sloppy_integers=>1, sloppy_floats=>1)->($r));' *.xsd < file.xml # YAML to XML perl -MYAML=LoadFile,Dump -MXML::Compile::Schema -le '$d=LoadFile(shift @ARGV); $r=shift @ARGV; $x=XML::LibXML::Document->new("1.0", "UTF-8"); $x=XML::Compile::Schema->new(\@ARGV)->compile(WRITER => $r)->($x, $d); print $x->toString(1)' file.yml '{http://some.name.space/}rootTag' *.xsd # YAML to XML where data are inside hash key perl -MYAML=LoadFile,Dump -MXML::Compile::Schema -le '$d=LoadFile(shift @ARGV); $r=shift @ARGV; ($a=$r)=~s/{.*}//; $x=XML::LibXML::Document->new("1.0", "UTF-8"); $x=XML::Compile::Schema->new(\@ARGV)->compile(WRITER => $r)->($x, $d->{$a}); print $x->toString(1)' file.yml '{http://some.name.space/}action' *.xsd