Command-line XML validator for Windows -
I have always found verification against a schema to be an invaluable ward against the thought and involved in the recognition investigation as I want to do a project where I need to submit files often. There is a good CLI integration feature in my text editor, so I am looking for a command line vedic.
When I did not get a clear winner through Google, none of these suggestions has been given that my needs fit perfectly:
- (Sagevin's Through) - does not report line numbers; I do not know where are my errors!
- - Can not run from the command line?
- - Need a copy of Visual C?
- - Can not run from the command line?
- - Inadequate XSD support *
(* Schema I replace groups - inappropriate, but it is external to the project, so I can not change it - Code> xmlstarlet also suffers on legitimate files.)
Normally, after solving this problem I leave a search for an existing solution and reach the python-hammer. , But the XML support of Python is extremely poor ... okay ... in fact, it's on "infamous" Let Chhattisgarh.
So I'm back in search of pre-existing tools. My requirements are very simple:
- Runs on Win32 (Windows XP SP3, in particular)
- Command line;
- Fully full XSD support (especially name space and replacement group)
- My editor can work with anything stdin / -out / -err, logic, Temporary files, etc. Report the line number where the error occurred!
Is such a device present? I did not want to install visual studios and friends (very bloated, IMO), but I already have both Saigwin and Python installed.
Your first option, xmllint (libxml2) returns the line number for errors in xml (and with Only in xsd) you probably need later version I confirmed both using my copy, which is:
& gt; Example: Xmllint --version xmllint: libxml version 20627
Example output:
invalidXml.xml: 4: element c: schema validity error: element 'C': This element is not expected expected (B) Failed to validate invalidXml.xml & lt ;? XML version = "1.0"? & Gt; & Lt; InvalidXmlEg> & Lt; A / & gt; & Lt ;! - & lt; B & gt; & Lt; / B & gt; - & gt; & Lt; C / & gt; & Lt; / InvalidXmlEg>
Where xsd is:
& 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 = "one" type = "x: string" /> & Lt; Xs: element name = "b" type = "x: string" /> & Lt; Xs: element name = "c" type = "x: string" /> & Lt; / XS: sequence & gt; & Lt; / XS: complexType & gt; & Lt; / XS: element & gt; & Lt; / XS: Schema & gt;
Note: I have noticed that xmllint will accept element names that should not do it (such as "
"), But it 'starts affecting your work.
Adding the "compiled" part to the edit version:
Compiled with: Threads Tree Output Push Reader Pattern Author SAXv1 FTP HTTP DTVIDLL Legacy C14n Catalog XPath XPointer XInclude Iconv ISO8859X Unicode Reggxps AutomatA Expressway Schema Schematron Debug Debug
Comments
Post a Comment