- or download this
#!/usr/local/bin/perl
...
# Note: the second argument must match the root-level element of the X
+ML
# document. I'm not quite sure why it's required here.
warn $schema->template('PERL', 'addresses');
- or download this
# is an unnamed complex
{ # sequence of address
...
# is a xs:string
# is optional
street => "example", }, ], }
- or download this
my $data = {
address => [
...
}
],
};
- or download this
my $doc = XML::LibXML::Document->new('1.0', 'UTF-8');
my $write = $schema->compile(WRITER => 'addresses');
...
$doc->setDocumentElement($xml);
print $doc->toString(1); # 1 indicates "pretty print"
- or download this
<?xml version="1.0" encoding="UTF-8"?>
<addresses>
...
<street>street 2</street>
</address>
</addresses>