{"id":7176,"date":"2022-12-20T19:35:44","date_gmt":"2022-12-20T22:35:44","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/xmllibxmlrelaxng-man3\/"},"modified":"2022-12-20T19:35:44","modified_gmt":"2022-12-20T22:35:44","slug":"xmllibxmlrelaxng-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/xmllibxmlrelaxng-man3\/","title":{"rendered":"XML::LibXML::RelaxNG (man3)"},"content":{"rendered":"<h1 align=\"center\">XML::LibXML::RelaxNG<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#METHODS\">METHODS<\/a><br \/> <a href=\"#AUTHORS\">AUTHORS<\/a><br \/> <a href=\"#VERSION\">VERSION<\/a><br \/> <a href=\"#COPYRIGHT\">COPYRIGHT<\/a><br \/> <a href=\"#LICENSE\">LICENSE<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">XML::LibXML::RelaxNG \u2212 RelaxNG Schema Validation<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">use XML::LibXML; <br \/> $doc = XML::LibXML\u2212>new\u2212>parse_file($url); <br \/> $rngschema = XML::LibXML::RelaxNG\u2212>new( location => $filename_or_url, no_network => 1 ); <br \/> $rngschema = XML::LibXML::RelaxNG\u2212>new( string => $xmlschemastring, no_network => 1 ); <br \/> $rngschema = XML::LibXML::RelaxNG\u2212>new( DOM => $doc, no_network => 1 ); <br \/> eval { $rngschema\u2212>validate( $doc ); };<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The XML::LibXML::RelaxNG class is a tiny frontend to libxml2\u2019s RelaxNG implementation. Currently it supports only schema parsing and document validation.<\/p>\n<h2>METHODS <a name=\"METHODS\"><\/a> <\/h2>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p style=\"margin-top: 1em\">new<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"80%\">\n<p style=\"margin-top: 1em\">$rngschema = XML::LibXML::RelaxNG\u2212>new( location => $filename_or_url, no_network => 1 );<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\">$rngschema = XML::LibXML::RelaxNG\u2212>new( string => $xmlschemastring, no_network => 1 ); <br \/> $rngschema = XML::LibXML::RelaxNG\u2212>new( DOM => $doc, no_network => 1 );<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">The constructor of XML::LibXML::RelaxNG needs to be called with list of parameters. At least location, string or <small>DOM<\/small> parameter is required to specify source of schema. Optional parameter no_network set to 1 cause that parser would not access network and optional parameter recover set 1 cause that parser would not call <b>die()<\/b> on errors.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">It is important, that each schema only have a single source.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">The location parameter allows one to parse a schema from the filesystem or a (non-HTTPS) <small>URL.<\/small><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">The string parameter will parse the schema from the given <small>XML<\/small> string.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">The <small>DOM<\/small> parameter allows one to parse the schema from a pre-parsed XML::LibXML::Document.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Note that the constructor will <b>die()<\/b> if the schema does not meed the constraints of the RelaxNG specification.<\/p>\n<p style=\"margin-left:11%;\">validate<\/p>\n<p style=\"margin-left:17%;\">eval { $rngschema\u2212>validate( $doc ); };<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">This function allows one to validate a (parsed) document against the given RelaxNG schema. The argument of this function should be an XML::LibXML::Document object. If this function succeeds, it will return 0, otherwise it will <b>die()<\/b> and report the errors found. Because of this <b>validate()<\/b> should be always evaluated.<\/p>\n<h2>AUTHORS <a name=\"AUTHORS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Matt Sergeant, Christian Glahn, Petr Pajas<\/p>\n<h2>VERSION <a name=\"VERSION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">2.0206<\/p>\n<h2>COPYRIGHT <a name=\"COPYRIGHT\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">2001\u22122007, AxKit.com Ltd.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">2002\u22122006, Christian Glahn.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">2006\u22122009, Petr Pajas.<\/p>\n<h2>LICENSE <a name=\"LICENSE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This program is free software; you can redistribute it and\/or modify it under the same terms as Perl itself.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  XML::LibXML::RelaxNG \u2212 RelaxNG Schema Validation <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3007,3508],"class_list":["post-7176","post","type-post","status-publish","format-standard","hentry","category-sin-categoria","tag-man3","tag-xmllibxmlrelaxng"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7176","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=7176"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7176\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=7176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=7176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=7176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}