Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your first option, xmllint (libxml2), does give line numbers for errors in the xml (and also in the xsd). You probably just need a later version. I just confirmed both using my copy, which is:</p> <pre><code>&gt; xmllint --version xmllint: using libxml version 20627 </code></pre> <p>Example output:</p> <pre><code>invalidXml.xml:4: element c: Schemas validity error : Element 'c': This element is not expected. Expected is ( b ). invalidXml.xml fails to validate &lt;?xml version="1.0"?&gt; &lt;invalidXmlEg&gt; &lt;a/&gt; &lt;!-- &lt;b&gt;&lt;/b&gt; --&gt; &lt;c/&gt; &lt;/invalidXmlEg&gt; </code></pre> <p>Where the xsd is:</p> <pre><code>&lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; &lt;xs:element name="invalidXmlEg"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="a" type="xs:string" /&gt; &lt;xs:element name="b" type="xs:string" /&gt; &lt;xs:element name="c" type="xs:string" /&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:schema&gt; </code></pre> <p>NOTE: I have noticed that xmllint will accept elements names that it shouldn't (e.g. "<code>&lt;invalidXml.xsd&gt;</code>"), but this doesn't seem to affect your task.</p> <p><em>EDIT</em> adding the "compiled with" part of the version:</p> <pre><code> compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 FTP HTTP DTDValid HTML Legacy C14N Catalog XPath XPointer XInclude Iconv ISO8859X Unicode Regexps Automata Expr Schemas Schematron Modules Debug Zlib </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload