You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Carsten Ziegeler <cz...@apache.org> on 2007/01/18 12:44:45 UTC

[RT] Add schema validation for sitemap

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.

Carsten

-- 
Carsten Ziegeler
http://www.osoco.org/weblogs/rael/

Re: [RT] Add schema validation for sitemap

Posted by Vadim Gritsenko <va...@reverycodes.com>.
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.

As long as it is flexible enough to not die when it encounters unknown to it 
sitemap component (with unknown configuration syntax), +1.

Vadim

Re: [RT] Add schema validation for sitemap

Posted by Carsten Ziegeler <cz...@apache.org>.
Schema validation for sitemaps is now in trunk. Its turned off by
default and activated for the running mode "dev".
You can activate validation by setting the property
"org.apache.cocoon.sitemap.validation" to "true" for the settings.

The schema already works for several sitemaps, but I'm sure that I
forgot some possibilities (which means some attributes). So it would be
great if people could validate their sitemaps using the schema and
either report problems or directly fix the schema.

Thanks
Carsten


-- 
Carsten Ziegeler
http://www.osoco.org/weblogs/rael/

Re: [RT] Add schema validation for sitemap

Posted by Niclas Hedhman <ni...@hedhman.org>.
On Friday 19 January 2007 07:24, Fred Vos wrote:
> 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.

+1. Also think that some users of Cocoon are not programmers, but they are 
probably all fairly comfortable with XML at large. Providing a Scheme is 
great for these. Whether or not schema validation should be available/default 
is perhaps less important at this point.

Cheers
Niclas

Re: [RT] Add schema validation for sitemap

Posted by Fred Vos <fr...@fredvos.org>.
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

Re: [RT] Add schema validation for sitemap

Posted by Reinhard Poetz <re...@apache.org>.
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.
>> 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.

probably it depends ;-)
I remember some weird error messages together with substitution groups and 
extension/restriction relationships but without having looked at the sitemap 
schema, I don't think it is that complicated.

As it will be configureable anyway and we already have all necessary libraries 
in our dependency graph, just add it. Whether we set schema validation to true 
or false per default, can be decided later on.

-- 
Reinhard Pötz           Independent Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}

                                        web(log): http://www.poetz.cc
--------------------------------------------------------------------

Re: [RT] Add schema validation for sitemap

Posted by Carsten Ziegeler <cz...@apache.org>.
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.
> 
> 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.

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

Carsten

-- 
Carsten Ziegeler
http://www.osoco.org/weblogs/rael/

Re: [RT] Add schema validation for sitemap

Posted by Reinhard Poetz <re...@apache.org>.
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.

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.

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

-- 
Reinhard Pötz           Independent Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}

                                        web(log): http://www.poetz.cc
--------------------------------------------------------------------

Re: [RT] Add schema validation for sitemap

Posted by Andrew Savory <an...@luminas.co.uk>.
Hi,

On 18 Jan 2007, at 11:44, Carsten Ziegeler wrote:

> 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.

A big +1 ... it always seemed somewhat ironic that an XML application  
framework didn't have any way to validate XML configurations when  
authoring them.


Thanks,

Andrew.
--
Andrew Savory, Managing Director, Luminas Limited
Tel: +44 (0)870 741 6658  Fax: +44 (0)700 598 1135
Web: http://www.luminas.co.uk/
Sourcesense: http://www.sourcesense.com/