Validating XML files against the DTDs: libaccounts-glib Reference Manual

## Validating XML files against the DTDs

DTDs exist for the XML file formats supported by libaccounts-glib. Using these DTDs, it is possible to validate the XML data files for errors. This is especially useful during the build or testing process of applications which use libaccounts-glib, so that errors in data files can be caught early.

### Using xmllint

xmllint is part of libxml2 and can be used to validate an XML document against a DTD. A sample command to validate the hypothetical XML file `coolprovider.xml` is:

    1
    xmllint --noout --dtdvalid /usr/share/xml/accounts/schema/dtd/accounts-provider.dtd coolprovider.xml

The `--noout` argument suppresses printing of the XML document, and `--dtdvalid` requests validation against a DTD, given by the following argument. By default, the libaccounts-glib DTDs are installed to `$(datadir)/xml/accounts/schema/dtd`, which usually expands to `/usr/share/xml/accounts/schema/dtd`.