Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quick Way to Validate XML/Identify Point of Brokenness [closed]

Tags:

xml

How does one check the validity of an XML file to show where the xml error occurs?

Firefox can do it, but I'd like to do it in linux/windows command line.

eg. I've got a large-ish (90MB) XML file from Excel, saved in XML Spreadsheet 2003 format. It contains various invalid data, so that Firefox spits out messages like this:

Line Number 790402, Column 65:
<Cell ss:StyleID="s18"><Data ss:Type="String">Here's some data I&#5;?Bnternational</Data></Cell>

Firefox is quite slow at parsing my XML(presumably because it's keeping it all in memory ready to render into a nice navigable tree). I'm not bothered about validation against an XSD, just want to know if the XML is well-formed.

like image 502
Dominic Rodger Avatar asked Sep 05 '25 11:09

Dominic Rodger


1 Answers

There's a linux command called xmllint that is good for this. It's very fast, handles honking great files without barfing, and gives useful validation error messages.

like image 84
skaffman Avatar answered Sep 11 '25 04:09

skaffman