Debian Codegraph @

lib/XML/LibXML/RelaxNG.pod

raw
1 =head1 NAME
2
3 XML::LibXML::RelaxNG - RelaxNG Schema Validation
4
5 =head1 SYNOPSIS
6
7
8
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
17 =head1 DESCRIPTION
18
19 The XML::LibXML::RelaxNG class is a tiny frontend to libxml2's RelaxNG
20 implementation. Currently it supports only schema parsing and document
21 validation.
22
23
24 =head1 METHODS
25
26 =over 4
27
28 =item new
29
30 $rngschema = XML::LibXML::RelaxNG->new( location => $filename_or_url );
31 $rngschema = XML::LibXML::RelaxNG->new( string => $xmlschemastring );
32 $rngschema = XML::LibXML::RelaxNG->new( DOM => $doc );
33
34 The constructor of XML::LibXML::RelaxNG may get called with either one of three
35 parameters. The parameter tells the class from which source it should generate
36 a validation schema. It is important, that each schema only have a single
37 source.
38
39 The location parameter allows one to parse a schema from the filesystem or a
40 URL.
41
42 The string parameter will parse the schema from the given XML string.
43
44 The DOM parameter allows one to parse the schema from a pre-parsed L<<<<<< XML::LibXML::Document >>>>>>.
45
46 Note that the constructor will die() if the schema does not meed the
47 constraints of the RelaxNG specification.
48
49
50 =item validate
51
52 eval { $rngschema->validate( $doc ); };
53
54 This function allows one to validate a (parsed) document against the given
55 RelaxNG schema. The argument of this function should be an
56 XML::LibXML::Document object. If this function succeeds, it will return 0,
57 otherwise it will die() and report the errors found. Because of this validate()
58 should be always evaluated.
59
60
61
62 =back
63
64 =head1 AUTHORS
65
66 Matt Sergeant,
67 Christian Glahn,
68 Petr Pajas
69
70
71 =head1 VERSION
72
73 2.0134
74
75 =head1 COPYRIGHT
76
77 2001-2007, AxKit.com Ltd.
78
79 2002-2006, Christian Glahn.
80
81 2006-2009, Petr Pajas.
82
83 =cut
84
85
86 =head1 LICENSE
87
88 This program is free software; you can redistribute it and/or modify it under
89 the same terms as Perl itself.
90