You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Colin Paul Adams <co...@colina.demon.co.uk> on 2002/10/24 18:52:08 UTC

RELAXNG grammar for sitemap

I have used the rng tool to generate a grammar for sitemap.xmap, from
sitemap-v04.dtd (patched version). I did this just to see how
difficult it was. As expected, it did not work automatically - I had
the same problem with dtd2xsd when trying to generate a WXS grammar.

The problem is the DTD effectively has two namespaces - the map:
namespace and the global namespace. I guess as DTDs do not support
namespaces, the conversion tools do not attempt to cope with this.

Still, I was able to systematically correct the grammar, so I could
automate the process with an emacs macro or some such.

The generated grammar is equivalent to the DTD grammar, and as such
fairly loose. I could go on to express the rules better now
(e.g. map:components should have at most one child of each type, but
in any order). Then perhaps write an ant validation task, or maybe
runtime validation through an coccon.xcong option?
-- 
Colin Paul Adams
Preston Lancashire

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: RELAXNG grammar for sitemap

Posted by Colin Paul Adams <co...@colina.demon.co.uk>.
>>>>> "David" == David Crossley <cr...@indexgeo.com.au> writes:

    David> I have come across many references to
    David> embedded-schematron-in-relax-ng Here is one such:
    David> http://www.topologi.com/public/Schtrn_XSD/Paper.html
    David> --David

Yes, that's just the sort of thing I was thinking of.
-- 
Colin Paul Adams
Preston Lancashire

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: RELAXNG grammar for sitemap

Posted by David Crossley <cr...@indexgeo.com.au>.
Colin Paul Adams wrote:
<snip/>
> What I shall be doing today (I'm offline during the day, BTW), if I
> have time after looking into the sitemap namespaces issue, is to
> take the rng grammar you generated (or generate a fresh one from a new
> DTD depending on what I find out about sitemap namespaces), and start
> changing it to overcome the DTD limitations (first change is to
> specify that map:components can be in any order, but at most one -
> using optionals nested in interleave - and go on in the same vain,
> iterating towards a better grammar).

Okay, thanks for the first draft RNG via Bugzilla.
It is in CVS now.

> I think we might one to eventually have a schematron schema AS WELL as
> an RNG and WXS grammar. The full validation would then consist of
> checking against both schemas, but I'm running too far ahead for now.

I have come across many references to embedded-schematron-in-relax-ng
Here is one such:
http://www.topologi.com/public/Schtrn_XSD/Paper.html
--David

>     David> Did you see the demonstration that i provided in the
>     David> abovementioned thread? It provides an Ant task for
>     David> build-time validation. Also Pete Royal followed up with
>     David> mention about validation of Configuration objects via
>     David> Avalon soon.  
> 
> I haven't had time to try it yet, but I downloaded the patches.
-- 
Colin Paul Adams
Preston Lancashire





---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: RELAXNG grammar for sitemap

Posted by Colin Paul Adams <co...@colina.demon.co.uk>.
>>>>> "David" == David Crossley <cr...@indexgeo.com.au> writes:

    David> I am not sure which tool you refer to. I had no problems at

rng which uses msv, by the author of msv.

    David> I presume that the draft sitemap DTD is using a workaround
    David> for the namespace lack, by having explicit element names
    David> which contain the "map:" prefix, e.g. <!ELEMENT
    David> map:components ...  This workaround is then reflected in
    David> the generated RNG.  Is that what you are referring to with
    David> your next statement?

That's correct.

    David> I gather that you are suggesting to maintain a canonical
    David> RNG grammar, which we use for system validation. Then from

I am suggesting just that. In my opinion the DTD grammar has no other
value than a starting point for some other grammar.

    David> that canonical RNG we can generate a WXS schema that can be
    David> used by any XML editors that cannot use RNG. That sounds
    David> like the way to go.

I agree.

    David> We should compare the two RNG grammars that are generated
    David> from sitemap-v04.dtd to decide which one to base any
    David> further work upon.


I have already done that. The one you generated is preferable in
several small ways (apart from the fact that it is legal! -
The rng tool creates defines of the form map:name, which is
illegal. The tool you used generates names of the form map.name, which
is ok)

    David> Or perhaps we should really write it
    David> from scratch, just using the generated ones for guidance.

What I shall be doing today (I'm offline during the day, BTW), if I
have time after looking into the sitemap namespaces issue, is to
take the rng grammar you generated (or generate a fresh one from a new
DTD depending on what I find out about sitemap namespaces), and start
changing it to overcome the DTD limitations (first change is to
specify that map:components can be in any order, but at most one -
using optionals nested in interleave - and go on in the same vain,
iterating towards a better grammar).

I think we might one to eventually have a schematron schema AS WELL as
an RNG and WXS grammar. The full validation would then consist of
checking against both schemas, but I'm running too far ahead for now.

    David> Did you see the demonstration that i provided in the
    David> abovementioned thread? It provides an Ant task for
    David> build-time validation. Also Pete Royal followed up with
    David> mention about validation of Configuration objects via
    David> Avalon soon.  

I haven't had time to try it yet, but I downloaded the patches.
-- 
Colin Paul Adams
Preston Lancashire

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: RELAXNG grammar for sitemap

Posted by David Crossley <cr...@indexgeo.com.au>.
Colin Paul Adams wrote:
> I have used the rng tool to generate a grammar for sitemap.xmap, from
> sitemap-v04.dtd (patched version). I did this just to see how
> difficult it was. As expected, it did not work automatically - I had
> the same problem with dtd2xsd when trying to generate a WXS grammar.

I am not sure which tool you refer to. I had no problems
at all when using DTDinst. See the URL for Jing and DTDinst
in the previous discussion on this topic:
 Re: DTD v. WXS v. Schematron v. RelaxNG
 http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=103545618018214

> The problem is the DTD effectively has two namespaces - the map:
> namespace and the global namespace. I guess as DTDs do not support
> namespaces, the conversion tools do not attempt to cope with this.

I presume that the draft sitemap DTD is using a workaround
for the namespace lack, by having explicit element names which
contain the "map:" prefix, e.g. <!ELEMENT map:components ...
This workaround is then reflected in the generated RNG.
Is that what you are referring to with your next statement?

> Still, I was able to systematically correct the grammar, so I could
> automate the process with an emacs macro or some such.
> 
> The generated grammar is equivalent to the DTD grammar, and as such
> fairly loose. I could go on to express the rules better now
> (e.g. map:components should have at most one child of each type, but
> in any order).

I gather that you are suggesting to maintain a canonical
RNG grammar, which we use for system validation. Then from
that canonical RNG we can generate a WXS schema that can be
used by any XML editors that cannot use RNG. That sounds like
the way to go.

We should compare the two RNG grammars that are generated
from sitemap-v04.dtd to decide which one to base any further
work upon. Or perhaps we should really write it from scratch,
just using the generated ones for guidance.

> Then perhaps write an ant validation task, or maybe
> runtime validation through an coccon.xconf option?

Did you see the demonstration that i provided in the
abovementioned thread? It provides an Ant task for
build-time validation. Also Pete Royal followed up
with mention about validation of Configuration objects
via Avalon soon.
--David





---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org