Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to check well-formedness of a big XML file. (about 4GB.)

However, when I try xmlwf, all it tells me is

filename.xml: Value too large for defined data type

What to do with it? Is there any other way to check it?

(I am using debian linux and gentoo linux)

share|improve this question
I'd guess any XML parser would work, as aren't they required to reject documents which aren't well-formed? A quick suggests checking if xmlstarlet does what you want. –  derobert Feb 22 '13 at 18:34
From man xmlwf: "-r Normally xmlwf memory-maps the XML file before parsing; this can result in faster parsing on many platforms. -r turns off memory-mapping and uses normal file IO calls instead. Of course, memory-mapping is automatically turned off when reading from standard input." By the way, I assume you are using a 64-bit setup... –  Deer Hunter Feb 22 '13 at 19:22

3 Answers 3

up vote 2 down vote accepted

You might like to try dtdgen, a program I wrote many years ago to generate a DTD for a document. It not only tells you whether a large file is well-formed, it also tells you what's in it (I wrote it because I wanted to know both).

share|improve this answer

Not try it myself, but try this out :

xmllint --valid 4GB.xml
share|improve this answer
I don't want to try if it's valid. I want to try if it's well-formed. –  Karel Bílek Feb 22 '13 at 18:10
Can you spot me the difference ? –  stArdustͲ Feb 22 '13 at 18:15
basically, it can't be valid if it doesn't have DTD. And I haven't yet wrote the DTD :) –  Karel Bílek Feb 22 '13 at 18:18
xmllint --noout 4GB.xml

That sort of works.

It goes out of memory, too, but at least it checks something before it dies.

share|improve this answer
does xmlint ship with most distros or do you have to install it separately? –  amphibient Feb 22 '13 at 20:39
@amphibient If not installed you have to install expat. –  TheodorosPloumis Jan 14 at 14:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.