cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fred Vos <f...@fredvos.org>
Subject Re: [RT] Add schema validation for sitemap
Date Thu, 18 Jan 2007 23:24:55 GMT
On Thu, Jan 18, 2007 at 01:50:52PM +0100, Carsten Ziegeler wrote:
> Reinhard Poetz wrote:
> > Carsten Ziegeler wrote:
> >> I started writing an XML schema for our sitemap. You can find a first
> >> version in the 2.1.x branch at tools/src/sitemap-1.0.xsd.
> >>
> >> My idea is to add schema validation to our tree processor engine in
> >> trunk and validate a sitemap when it is read. Of course this will be
> >> configurable and can be turned off.
> >>
> >> I'm not interested in discussions whether XML schema is the best
> >> solution for validation. But I'm interested to hear if others think that
> >> this is a useful idea or not.

I think it's a great idea to have a schema. A good schema is an excellent
source of documentation. Especially when full of annotations, enumerations,
limits, patterns et cetera. I prefer to validate every parsed xml document in
my software with a schema stored locally. Especially with xml documents from
external sources.

> > 
> > So far I've been happy with the validation performed by the tree processor. One

> > problem with schema validation is that the error messages are often difficult to

> > understand. It could  also be confusing to our users if validation errors come 
> > from two different sources.
> Hmm, yes, might be. The current validation of the tree processor is not
> complete, for example it doesn't detect typos (try using map:prameter
> for example).
> The validation errors of the parser are very good imho, they tell you
> exactly where which error occurs. In addition, they tell you which
> elements are allowed, so you can spot typos etc. very easily.

The validation messages are indeed difficult to understand. It's a pity
there's not yet a validator that can produce messages that give a clue. The
advantage of validating against a schema is that it is very strict. It usually
doesn't accept anything it doesn't know and thus protects against typos or
simple mistakes like using 'yes' instead of 'true'. Maybe the validation of
the tree processor does find such mistakes. I don't think validating against a
schema can replace the current system yet.

Are you going to offer an either/or configuration? Either the tree processor
or the schema? Otherwise it will be a double check.

> 
> > 
> > IMO a sitemap schema is useful in XML editors that use it to provide code 
> > completion and validation.
> > 
> True.

And it's a great source of documentation. And one can validate a document
against the schema before installing it in a Cocoon based site, for instance
with xmllint with the 'schema' option. A simple check during an automated
update process is possible now!

Fred

-- 
|E  R
| D  F
|
|fred at fredvos dot org
|5235 DG 52 NL +31 73 6411833

Mime
View raw message