I've been (successfully) using XML validation (against xsd/schemas specified as xsi:schemaLocation inside the XML itself)
with Xerces via this wrapping validating class:
XML::Validate
which has 3 backends for validating, one being Xerces
XML::Validate::Xerces

Just a snippet of how such XML-docs are:
 
<person xmlns="http://www.cafeconleche.org/namespaces/person"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.cafeconleche.org/namespaces/person
                      http://www.elharo.com/person.xsd">
  <name>
    <first_name>Alan</first_name>
    <last_name>Turing</last_name>
  </name>
   ...
I'm trying now to move out from Xerces (libxml or anything else)
The libxml shipped backend (of that XML::Validate):
XML::Validate::LibXML
doesn't seem anyhow able to manage the validation against xsd/schema but only against dtd.
It doesn't seem this class is going to be updated either, as it was not since 2006.

Is there any perl "standard" way nowadays to validate XML with bultin xsd/schemas in xsi:schemaLocation ?
I would have chosen XML::LibXML::Schema
which seems still the "standard" way. It also didn't receive updates since a while and it states:
Currently it supports only schema parsing and document validation.
I would then assume it doesn't support the validation from just the XML (with the inline xsi:schemaLocation)
All the examples I've found are a 2 steps process:
1. you must first know where the schema is (local or remote (if remote http only, not https)), to create an instance of XML::LibXML::Schema
2. feed this created instance with the XML-doc, to validate it.

So the only way to use that with inline xsi:schemaLocation, would seem to extract first them out from the XML-doc and get the url, create a validator instance with that location and then validate the XML-doc.
Am I missing a proper way to use this class, or am I missing any other better class ? Thank you very much to everyone.

In reply to Validate XML with schemas specified inline (xsi:schemaLocation) (with libxml or anything different from Xerces) by jjmoka

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.