#!/usr/local/bin/perl #------------------------------Basic-----------------------------------------# use warnings; use strict; #----------------------------- Specific Module ------------------------------# use Data::Dumper; use XML::Compile::Schema; use XML::LibXML::Reader; #----------------------------- XSD Analyse ----------------------------------# my $xsd = "T://RoGa//test.xsd"; my $schema = XML::Compile::Schema->new($xsd); # This will print a very basic description of what the schema describes #$schema->printIndex(); # This will print a expample whit posible values. warn $schema->template( 'PERL', 'CQA' ); #----------------------------- XML Data -------------------------------------# my $data = { INFO => { owner => 'R.Galli', name => 'Perl-XML', description => 'Perl-XML-DES', date => '2014-12-13', status => '1', version => '9.08', }, LOG => { message => 'LOG INFO 1', },}; #----------------------------- XML Out --------------------------------------# my $doc = XML::LibXML::Document->new( '1.0', 'UTF-8' ); my $write = $schema->compile( WRITER => 'CQA' ); my $xml = $write->( $doc, $data ); $doc->setDocumentElement($xml); print $doc->toString(1); # 1 indicates "pretty print";