xml changed file validation

John Ralls jralls at ceridwen.us
Sat Jul 24 10:54:57 EDT 2010

On Jul 24, 2010, at 3:04 PM, Frank H. Ellenberger wrote:

> Am Samstag, 24. Juli 2010 um 14:30:52 schrieb Tom Bullock:
>> In the wiki for translating the GnuCash Guide & Help files there is the
>> instruction to that "xml file has no syntax errors"  and it indicates
>> using the command:  "xmllint --valid --noout  gnucash-guide.xml"
>> This instruction assumes the reader knows the context of that command
>> and how it is setup and works.   
> The program xmllint is part of the package libxml.
> As usual "xmllint --help" shows you the options and "man xmllint" some 
> explainations.
>> When I google 'xmllint' I get lots of 
>> references.  Since I want to validate just my changes, I should replace
>> 'gnucash-guide.xml' with the name of my changed module, correct?  I
>> don't need to validate what I am not changing, correct?
> Yes, I believe so.
> Feel free to add your experience to the wiki.

"Validation" is an XML term meaning to ensure that the XML document is well-formed (is syntactically correct) and that it complies with the DTDs or schemas listed in its header. 

Gnucash-guide.xml is the only file which has an XML header (it includes the other files by declaring them as ENTITIES in the local part of the DTD, so validation *should* fail on any of the other files (no DOCTYPE header); but if xmllint is OK with that, they will pass perhaps spuriously because they have no reference to the DocBook DTD and so won't be validated. 

Since XML parsers are required to be completely intolerant of errors, it's important that the whole document passes validation before it's checked in; similarly, since the current document parses correctly, it is likely valid.

Bottom Line: You have to validate gnucash-guide.xml.  If you're feeling defensive, run xmllint --valid before you make any changes.

John Ralls

More information about the gnucash-devel mailing list