1XML::LibXML::RelaxNG(3)User Contributed Perl DocumentatioXnML::LibXML::RelaxNG(3)
2
3
4

NAME

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

SYNOPSIS

9         use XML::LibXML;
10         $doc = XML::LibXML->new->parse_file($url);
11
12         $rngschema = XML::LibXML::RelaxNG->new( location => $filename_or_url );
13         $rngschema = XML::LibXML::RelaxNG->new( string => $xmlschemastring );
14         $rngschema = XML::LibXML::RelaxNG->new( DOM => $doc );
15         eval { $rngschema->validate( $doc ); };
16

DESCRIPTION

18       The XML::LibXML::RelaxNG class is a tiny frontend to libxml2's RelaxNG
19       implementation. Currently it supports only schema parsing and document
20       validation.
21

METHODS

23       new
24             $rngschema = XML::LibXML::RelaxNG->new( location => $filename_or_url );
25             $rngschema = XML::LibXML::RelaxNG->new( string => $xmlschemastring );
26             $rngschema = XML::LibXML::RelaxNG->new( DOM => $doc );
27
28           The constructor of XML::LibXML::RelaxNG may get called with either
29           one of three parameters. The parameter tells the class from which
30           source it should generate a validation schema. It is important,
31           that each schema only have a single source.
32
33           The location parameter allows one to parse a schema from the
34           filesystem or a URL.
35
36           The string parameter will parse the schema from the given XML
37           string.
38
39           The DOM parameter allows one to parse the schema from a pre-parsed
40           XML::LibXML::Document.
41
42           Note that the constructor will die() if the schema does not meed
43           the constraints of the RelaxNG specification.
44
45       validate
46             eval { $rngschema->validate( $doc ); };
47
48           This function allows one to validate a (parsed) document against
49           the given RelaxNG schema. The argument of this function should be
50           an XML::LibXML::Document object. If this function succeeds, it will
51           return 0, otherwise it will die() and report the errors found.
52           Because of this validate() should be always evaluated.
53

AUTHORS

55       Matt Sergeant, Christian Glahn, Petr Pajas
56

VERSION

58       2.0201
59
61       2001-2007, AxKit.com Ltd.
62
63       2002-2006, Christian Glahn.
64
65       2006-2009, Petr Pajas.
66

LICENSE

68       This program is free software; you can redistribute it and/or modify it
69       under the same terms as Perl itself.
70
71
72
73perl v5.30.0                      2019-07-26           XML::LibXML::RelaxNG(3)
Impressum