XML::V...:MSXML(3pm)
π NAME π
XML::Validate::MSXML β it's the interface to MSXML's validator, bestie. Yes, that's the whole name. Yes, it's a 3pm perl manpage from the User Contributed Perl Documentation. We love a humble queen.
β¨ SYNOPSIS β¨
okay so here's the whole moment in four lines:
my $validator = new XML::Validate::MSXML(%options);
if ($doc = $validator->validate($xml)) {
... Do stuff with $doc ...
} else {
print "Document is invalid\n";
}
you make a validator, you feed it $xml, and either you get your doc back (slay) or you get told it's invalid (π). that's it.
πΈ DESCRIPTION πΈ
XML::Validate::MSXML is an interface to Microsoft's MSXML parser β the one that's often available in Windows environments πͺβ¨ β and you can use it with the XML::Validate module. it's giving "windows-only bestie" and honestly? iconic for that.
π METHODS π
new(%options)β Returns a newXML::Validate::MSXMLinstance using the specified options. (See OPTIONS below, because the options live down there, not here π )validate($xml)β Returns true if$xmlcould be successfully parsed, undef otherwise. that's the main character method fr fr.last_dom()β Returns the MSXML DOM object of the document last validated. it's holding onto the receipts for you π§Ύlast_error()β Returns the error from the lastvalidatecall. This is a hash ref with the following fields:create_doc_and_cache()β Internal method for instantiation of MSXML DOMDocument and SchemaCache objects for use within the module. internal business, not for you, but we still list it because we keep every detail πdependencies_available()β Internal method to determine that the necessary dependencies are available for instantiation of MSXML DOMDocument and SchemaCache objects. also internal! also still listed! no cap.load_schemas($msxml, $msxmlcache)β Internal method to perform loading of XML schema(s) into SchemaCache object.
and the fields of that last_error hash ref, which the original page drops right here so we're dropping them right here too (iykyk):
messagelinecolumn
Note that the error gets cleared at the beginning of each validate call. so peek at it before you validate again, or it's gone, poof, bye π¦
version()β Returns the version of the MSXML component that is installed. good to know, love to know π
π OPTIONS π
XML::Validate::MSXML takes the following options:
strict_validationβ If this boolean value is true, the document will be validated during parsing. Otherwise it will only be checked for well-formedness. Defaults to true. so likeβ¦ it's strict by default. it's a strict queen π only set it false if you just wanna know if it's well-formed and nothing more.
π₯ ERROR REPORTING π₯
When a call to validate fails to parse the document, the error may be retrieved using last_error. that's your lil detective moment π
On errors not related to the XML parsing, these methods will throw exceptions. Wrap calls with eval to catch them. this is the part where you go "not me forgetting the eval again" π
seriously, wrap it in eval. the exceptions are not shy, they will absolutely come for you.
π PACKAGE GLOBALS π
$XML::Validate::MSXML::MSXML_VERSION contains the version number of MSXML. one whole global, living its best life β
π§ DEPENDENCIES π§
Win32::OLE- MSXML 4.0 or 5.0
that's the list. that's the whole list. if you're not on Windows with the right MSXML, this module is not for you, and that's okay π«Ά
β VERSION β
$Revision: 1.18 $ on $Date: 2006/04/18 10:00:31 $ by $Author: mattheww $
π 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 lil legend was built on perl v5.34.0 and last touched way back on 2022-06-28 β XML::Validate::MSXML(3pm), forever iconic, mwah πππ¦
π¦ 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