1XML::LibXML::Schema(3)User Contributed Perl DocumentationXML::LibXML::Schema(3)
2
3
4
6 XML::LibXML::Schema - XML Schema Validation
7
9 use XML::LibXML;
10 $doc = XML::LibXML->new->parse_file($url);
11
12 $xmlschema = XML::LibXML::Schema->new( location => $filename_or_url );
13 $xmlschema = XML::LibXML::Schema->new( string => $xmlschemastring );
14 eval { $xmlschema->validate( $doc ); };
15
17 The XML::LibXML::Schema class is a tiny frontend to libxml2's XML
18 Schema implementation. Currently it supports only schema parsing and
19 document validation. As of 2.6.32, libxml2 only supports decimal types
20 up to 24 digits (the standard requires at least 18).
21
23 new
24 $xmlschema = XML::LibXML::Schema->new( location => $filename_or_url );
25 $xmlschema = XML::LibXML::Schema->new( string => $xmlschemastring );
26
27 The constructor of XML::LibXML::Schema may get called with either
28 one of two parameters. The parameter tells the class from which
29 source it should generate a validation schema. It is important,
30 that each schema only have a single source.
31
32 The location parameter allows one to parse a schema from the
33 filesystem or a URL.
34
35 The string parameter will parse the schema from the given XML
36 string.
37
38 Note that the constructor will die() if the schema does not meed
39 the constraints of the XML Schema specification.
40
41 validate
42 eval { $xmlschema->validate( $doc ); };
43
44 This function allows one to validate a (parsed) document against
45 the given XML Schema. The argument of this function should be a
46 XML::LibXML::Document object. If this function succeeds, it will
47 return 0, otherwise it will die() and report the errors found.
48 Because of this validate() should be always evaluated.
49
51 Matt Sergeant, Christian Glahn, Petr Pajas
52
54 2.0132
55
57 2001-2007, AxKit.com Ltd.
58
59 2002-2006, Christian Glahn.
60
61 2006-2009, Petr Pajas.
62
64 This program is free software; you can redistribute it and/or modify it
65 under the same terms as Perl itself.
66
67
68
69perl v5.28.0 2017-10-28 XML::LibXML::Schema(3)