Re: [widget] relax NG schema

On Aug 31, 2009, at 21:56 , Marcos Caceres wrote:
> On Aug 31, 2009, at 8:06 PM, mozer <xmlizer@gmail.com> wrote:
>> On Mon, Aug 31, 2009 at 4:10 PM, Robin Berjon<robin@berjon.com>  
>> wrote:
>>> On Aug 31, 2009, at 15:58 , Marcos Caceres wrote:
>>>>
>>>> As we have partitioned the P&C spec into multiple specs, the  
>>>> RelaxNG
>>>> schema is no longer complete (e.g., excludes updates and warp). I  
>>>> suggest we
>>>> rip the relax NG schema out of the P&C spec and republish it as a
>>>> non-normative note. That way, we can update it separately if we  
>>>> spawn any
>>>> new specs or if things change.
>>>
>>> That's one option. Another option is to define it using groups,  
>>> and have the
>>> other specs compose their additions in the groups. It's not very  
>>> hard to do.
>>
>> +1 for using groups
>
> Ok, what are these crazy groups you speak of? Please explain.

It's quite trivial, and one of the features that shows just how nice  
RelaxNG is. Let's look at an example.

If you look at the top of http://www.w3.org/Graphics/SVG/1.2/rng/Tiny-1.2/shapes.rng 
, you'll see:

<define name="svg.GCommon.group" combine="choice">
   <choice>
     <ref name="path"/>
     <ref name="rect"/>
     <ref name="circle"/>
     <ref name="line"/>
     <ref name="ellipse"/>
     <ref name="polyline"/>
     <ref name="polygon"/>
   </choice>
</define>

That's one instance of a group that is the common content for  
containers in SVG. But those containers can't just contain shapes, so  
what's going on? If you look at http://www.w3.org/Graphics/SVG/1.2/rng/Tiny-1.2/video.rng 
  you get:

<define name="svg.GCommon.group" combine="choice">
   <ref name="video"/>
</define>

The trick's in the @combine=choice — it combines the content of all  
the <define>s of the same name according to its value (here, as if by  
<choice>). You can look through the SVG Tiny 1.2 RNG and you'll see a  
lot of that. At the end, modules are independent, and can easily be  
augmented. It's simple, and it works really well.

It would be straightforward to have a P+C module with a group for the  
choice of its children, and then for instance WARP could just add  
<access> to that content.

Furthermore, since the schema isn't normative anyway, I think it could  
just sit in CVS like a software project and be pointed to by the  
specs. No need to include it in the spec's body.

-- 
Robin Berjon - http://berjon.com/

Received on Tuesday, 1 September 2009 10:15:57 UTC