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

AUTHORS

59       Matt Sergeant, Christian Glahn, Petr Pajas
60

VERSION

62       2.0209
63
65       2001-2007, AxKit.com Ltd.
66
67       2002-2006, Christian Glahn.
68
69       2006-2009, Petr Pajas.
70

LICENSE

72       This program is free software; you can redistribute it and/or modify it
73       under the same terms as Perl itself.
74
75
76
77perl v5.38.0                      2023-07-21           XML::LibXML::RelaxNG(3)
Impressum