[PATCH] XML validity of kcfg files
Frans Englich
frans.englich at telia.com
Sat Nov 20 14:04:56 GMT 2004
On Saturday 20 November 2004 01:15, Benjamin Meyer wrote:
> On Wednesday 03 November 2004 1:19 am, Frans Englich wrote:
> > On Wednesday 03 November 2004 02:22, Cornelius Schumacher wrote:
> > > On Wednesday 03 November 2004 01:24, Frans Englich wrote:
<snip>
> So what is the proper way to validate the xml files?
These lines:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd"
says "the prefix xsi refers to the XML application XMLSchema-instance" by
identifying it with the 'http://www.w3.org/2001/XMLSchema-instance'
namespace, and then it binds a WXS(W3C XML Schema) to that namespace with
schemaLocation, such that the validator can figure out the schema for a
certain namespace. It's possible to specify multiple schemas by putting pairs
of namespaces+WXS in schemaLocation. The validator may choose to ignore what
schemaLocation says, and fetch the Schema from some other place.
But. libxml2 does not yet support XMLSchema-instance. In other words, it can't
figure out the Schema from the document instance, so it must be explicitly
specified from the outside. Typically, like this:
xmllint --noout --schema http://www.kde.org/standards/kcfg/1.0/kcfg.xsd
foo.kcfg
(And the kcfg file must have a proper declaration, as the docs in kcfg.xsd
explains, and HEAD:kdepim/korganizer/korganizer.kcfg exemplifies.)
There's a bug report for Schema Instance support in xmllint, and there's
preliminary support for it, so I wouldn't be surprised if it turned up in the
next release.
That you get a complain about missing DTD is probably because you passed
--valid(and that's for XML validness as opposed to Schema validness).
As for how good xmllint is as a validator, to reflect on Cornelis' comment;
xmllint can certainly be improved, but I don't know if there's any other
which are particularly better(not that WXS validators exactly grows on
threes). It have bad usability: the error messages don't identify
what's wrong, but I've filed bug reports like a monkey for that, so it will
be fixed(and in some cases is fixed). I've also found small quirks in its
compliance, but there BRs for that(or fixed). When those small annoyances are
ironed out, I don't know what to ask for, especially considering libxml2's
speed.
(I learn when I try to retell.)
Cheers,
Frans
More information about the kde-core-devel
mailing list