XML::V...:Xerces(3pm)
π XML::Validate::Xerces β the manual page, but make it cute
okay bestie, so this is XML::Validate::Xerces, straight outta the User Contributed Perl Documentation section of your friendly neighbourhood perl install. It's the lil interface that lets the XML::Validate module borrow the Xerces parser for a vibe check on your XML. buckle up, we're doing this π
β¨ NAME β¨
XML::Validate::Xerces - Interface to Xerces validator
β¨ SYNOPSIS β¨
my $validator = new XML::Validate::Xerces(%options);
if ($doc = $validator->validate($xml)) {
... Do stuff with $doc ...
} else {
print "Document is invalid\n";
}
β¨ DESCRIPTION β¨
So like, XML::Validate::Xerces is an interface to the Xerces parser, and its whole personality is being usable with the XML::Validate module. that's it, that's the job π
β¨ METHODS β¨
new(%options)β hands you a brand newXML::Validate::Xercesinstance, built with whatever options you passed. (peep the OPTIONS section below, it's all there π«Ά)validate($xml)β returns a true value if$xmlcould be successfully parsed, andundefotherwise. simple as β¨last_dom()β returns the Xerces DOM object of the document that got validated most recently. like a lil souvenir of the last parse πlast_error()β returns the error from the lastvalidatecall. it's a hash ref, and the fields are:messagelinecolumn
heads up bestie: the error gets cleared at the beginning of each validate call. so grab it while it's fresh, no procrastinating π
version()β returns the version of theXML::Xercesmodule that's installed. iconique, we love a version check π
β¨ OPTIONS β¨
XML::Validate::Xerces takes these options, periodt:
strict_validationβ if this boolean is true, the document gets validated during parsing. otherwise it's only checked for well-formedness (which is lowkey a different thing). defaults to true. no cap.base_uriβ because the XML document is handed over as a string, the validator literally doesn't know the document's URI π. so if your document contains any components referenced using relative URI's, you need to set this option to the document's URI, so the validator can go retrieve them correctly. do not skip this, fr fr.
β¨ ERROR REPORTING β¨
when a call to validate fails to parse the document, you can retrieve the error with last_error.
on errors that are not related to XML parsing, these methods will throw exceptions π. so wrap your calls in eval to catch them, bestie. no exceptions β well, actually, yes exceptions, that's the whole point π§
β¨ DEPENDENCIES β¨
XML::Xerces
β¨ BUGS β¨
okay so this part is giving fragile, listen up:
XML::Xercescontains anINITblock that doesn't get run, because we load the module inside aneval. this causes a warning message to be printed π. so then we run the code inXML::Xercesourselves β but this is fragile, becauseXML::Xercesmight change on us. we need to keep an eye on this. literally watching it like πXML::Xercesreacts badly to code that doesuse UNIVERSAL(see <http://issues.apache.org/bugzilla/show_bug.cgi?id=25788>).XML::Validate::Xercesinherits this bug, unfortunately. modules known to cause problems includeTime::Pieceand versions ofXML::Twigprior to April 2005. so like, be careful out there π«Ά
β¨ VERSION β¨
$Revision: 1.21 $ on $Date: 2005/09/06 11:05:09 $ by $Author: johna $
β¨ AUTHOR β¨
Nathan Carr, Colin Robertson
<cpan _at_ bbc _dot_ co _dot_ uk>
β¨ COPYRIGHT β¨
(c) BBC 2005. This program is free software; you can redistribute it and/or modify it under the GNU GPL. See the file COPYING in this distribution, or <http://www.gnu.org/licenses/gpl.txt>
and that's the whole page, bestie! this was generated forperl v5.34.0on2022-06-28, and honestly? iconic. go validate something and slay π πβ¨
π¦ where this page comes from
- debian bookworm: libxml-validate-perl 1.025-4 Β· GPL-1.0-or-later
- debian trixie: libxml-validate-perl 1.025-4 Β· GPL-1.0-or-later
- ubuntu noble: libxml-validate-perl 1.025-4 Β· GPL-1.0-or-later
- ubuntu resolute: libxml-validate-perl 1.025-4 Β· GPL-1.0-or-later
- ubuntu stonking: libxml-validate-perl 1.025-4 Β· GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms