Last active
July 30, 2021 17:18
-
-
Save c-alpha/be0c0a9f73fb388ef1a6b2a1ac28d3f8 to your computer and use it in GitHub Desktop.
Validate against W3C XML Schema (XSD) 1.1 in Perl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use XML::Compile::Schema; # XML::LibXML does not support W3C XML SChema 1.1 (but which we need) | |
my $xmlschemastring = q(<?xml version="1.0" encoding="UTF-8"?> | |
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
... | |
elementFormDefault="qualified" | |
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" | |
vc:minVersion="1.1"> | |
<xs:element ... | |
</xs:schema>); | |
my $schema = XML::Compile::Schema->new($xmlschemastring); | |
my $reader = $schema->compile(READER => '{my_namespace}my_root_element'); | |
my $conf = $reader->($my_xmlfile); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment