[examplotron] Re: Choice Compositor?

From: Eric van der Vlist <[email protected]>
Date: Thu Jan 12 2006 - 20:41:32 UTC

Hi,

Le jeudi 12 janvier 2006 � 11:48 -0800, Renaud Waldura a �crit :
> Dear Examplotron Users:
>
> I work for the University of California at San Francisco. My department, the
> Center for HIV Information, manages a large set of XML documents about HIV
> research and prevention. Most XML documents are processed using XSL into
> HTML and displayed on our Web sites. XML is also used to store information
> about HIV providers and researchers. No schemas are used anywhere, the
> document structure is meant to be self-documenting, with the associated
> problems -- i.e. it isn't self-documenting, variants are rarely documented,
> and it takes a while for new people to pick the structure.
>
> I'm investigating how schema validation could help us manage and document
> schemas and their variants. Our staff typically does not have a technical
> background, and training them on a schema language is a big issue. (W3C
> Schema was immediately eliminated because of its complexity -- frankly it
> scared me off.) But Examplotron, thanks to its iconic properties, seems like
> a gentle way to introduce schema usage. Any comments?

That's the goal!

> I've started using Examplotron 0.7 myself, and quickly ran into the lack of
> a choice compositor. The manual says "The last Relax NG compositors (choice)
> has not been implemented since it doesn't seem very useful as a compositor
> for the whole content of an element."

Yep... What I meant is that the control we have right now is done
through attributes such as in:

<?xml version="1.0" encoding="UTF-8"?>
<order no="1234" date="2003-02-01"
 eg:content="eg:interleave" xmlns:eg="http://examplotron.org/0/">
        <quantity>1</quantity>
        <ref>AZERTY</ref>
        <item>Tee shirt</item>
        <price unit="USD">10.</price>
</order>

Using the same approach would lead to :

<?xml version="1.0" encoding="UTF-8"?>
<order no="1234" date="2003-02-01"
 eg:content="eg:choice" xmlns:eg="http://examplotron.org/0/">
        <quantity>1</quantity>
        <ref>AZERTY</ref>
        <item>Tee shirt</item>
        <price unit="USD">10.</price>
</order>

which doesn't make sense since that would mean that the complete content
of the "order" element is one of either <quantity/>, <ref/>, <item/> or
<price/>.

What we often need a choice operator is to chose between two elements,
such as if we wanted to include either a <ref/> or a <name/> element in
the content of the <order/> element.

> Any ideas on how this could be done if one needed it?

Any suggestion would be welcome!

The easy way to do so would be to add an "eg:choice" element:

<?xml version="1.0" encoding="UTF-8"?>
<order no="1234" date="2003-02-01"
 eg:content="eg:choice" xmlns:eg="http://examplotron.org/0/">
        <quantity>1</quantity>
        <eg:choice>
          <ref>AZERTY</ref>
          <name>TShirt</name>
        </eg:choice>
        <item>Tee shirt</item>
        <price unit="USD">10.</price>
</order>

Now, that doesn't seem very "iconic" and we're transforming Examplotron
into a "classical" schema language such as RELAX NG.

Generally speaking, that would be real easy to accept RNG elements in
Examplotron... But is it really a good solution?

What do you think?

Eric

-- 
Curious about Relax NG? Read my book online.
                                   http://books.xmlschemata.org/relaxng/
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
(ISO) RELAX NG   ISBN:0-596-00421-4 http://oreilly.com/catalog/relax
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema
------------------------------------------------------------------------
Received on Thu Jan 12 21:41:34 2006

This archive was generated by hypermail 2.1.8 : Wed Apr 12 2006 - 14:51:01 UTC