1XML::LibXML::Schema(3)User Contributed Perl DocumentationXML::LibXML::Schema(3)
2
3
4

NAME

6       XML::LibXML::Schema - XML Schema Validation
7

SYNOPSIS

9         use XML::LibXML;
10         $doc = XML::LibXML->new->parse_file($url);
11
12         $xmlschema = XML::LibXML::Schema->new( location => $filename_or_url, no_network => 1 );
13         $xmlschema = XML::LibXML::Schema->new( string => $xmlschemastring, no_network => 1 );
14         eval { $xmlschema->validate( $doc ); };
15

DESCRIPTION

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

METHODS

23       new
24             $xmlschema = XML::LibXML::Schema->new( location => $filename_or_url, no_network => 1 );
25             $xmlschema = XML::LibXML::Schema->new( string => $xmlschemastring, no_network => 1 );
26
27           The constructor of XML::LibXML::Schema needs to be called with list
28           of parameters. At least location or string parameter is required to
29           specify source of schema. Optional parameter no_network set to 1
30           cause that parser would not access network and optional parameter
31           recover set 1 cause that parser would not call die() on errors.
32
33           It is important, that each schema only have a single source.
34
35           The location parameter allows one to parse a schema from the
36           filesystem or a (non-HTTPS) URL.
37
38           The string parameter will parse the schema from the given XML
39           string.
40
41           Note that the constructor will die() if the schema does not meed
42           the constraints of the XML Schema specification.
43
44       validate
45             eval { $xmlschema->validate( $doc ); };
46
47           This function allows one to validate a (parsed) document against
48           the given XML Schema. The argument of this function should be a
49           XML::LibXML::Document object. If this function succeeds, it will
50           return 0, otherwise it will die() and report the errors found.
51           Because of this validate() should be always evaluated.
52

AUTHORS

54       Matt Sergeant, Christian Glahn, Petr Pajas
55

VERSION

57       2.0207
58
60       2001-2007, AxKit.com Ltd.
61
62       2002-2006, Christian Glahn.
63
64       2006-2009, Petr Pajas.
65

LICENSE

67       This program is free software; you can redistribute it and/or modify it
68       under the same terms as Perl itself.
69
70
71
72perl v5.34.0                      2021-07-23            XML::LibXML::Schema(3)
Impressum