Subversion Repositories Applications.papyrus

Rev

Blame | Last modification | View Log | RSS feed

<?xml version='1.0' encoding='UTF-8'?>
<!-- http://www.xml.com/lpt/a/2002/01/23/relaxng.html -->
<!-- http://www.oasis-open.org/committees/relax-ng/tutorial-20011203.html -->
<!-- http://www.zvon.org/xxl/XMLSchemaTutorial/Output/ser_wildcards_st8.html -->

<grammar xmlns='http://relaxng.org/ns/structure/1.0'
        xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
        xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
        ns='http://purl.org/rss/1.0/'
        datatypeLibrary='http://www.w3.org/2001/XMLSchema-datatypes'>

    <start>
        <element name='RDF' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
            <ref name='RDFContent'/>
        </element>
    </start>   

    <define name='RDFContent' ns='http://purl.org/rss/1.0/'>
        <interleave>
            <element name='channel'>
                <ref name='channelContent'/>
            </element>
            <optional>
                <element name='image'><ref name='imageContent'/></element>
            </optional>
            <oneOrMore>
                <element name='item'><ref name='itemContent'/></element>
            </oneOrMore>
        </interleave>
    </define>

     <define name='channelContent' combine="interleave">
        <interleave>
            <element name='title'><data type='string'/></element>
            <element name='link'><data type='anyURI'/></element>
            <element name='description'><data type='string'/></element>
            <element name='image'>
                <attribute name='resource' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
                    <data type='anyURI'/>
                </attribute>
            </element>
            <element name='items'>
                    <ref name='itemsContent'/>
            </element>
            <attribute name='about' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
                <data type='anyURI'/>
            </attribute>
        </interleave>
    </define>
    
        <define name="itemsContent">
            <element name="Seq" ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
                <oneOrMore>
                    <element name="li" ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
                        <choice>
                            <attribute name='resource'>    <!-- Why doesn't RDF/RSS1.0 ns qualify this attribute? -->
                                <data type='anyURI'/>
                            </attribute>
                            <attribute name='resource' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
                                <data type='anyURI'/>
                            </attribute>
                        </choice>
                    </element>
                </oneOrMore>
            </element>
        </define>
        
    <define name='imageContent'>
        <interleave>
            <element name='title'><data type='string'/></element>
            <element name='link'><data type='anyURI'/></element>
            <element name='url'><data type='anyURI'/></element>
            <attribute name='about' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
                <data type='anyURI'/>
            </attribute>
        </interleave>
    </define>

    <define name='itemContent'>
        <interleave>
            <element name='title'><data type='string'/></element>
            <element name='link'><data type='anyURI'/></element>
            <optional><element name='description'><data type='string'/></element></optional>
            <ref name="anyThing"/>
            <attribute name='about' ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
                <data type='anyURI'/>
            </attribute>
        </interleave>
    </define>            
            

        <define name='anyThing'>
            <zeroOrMore>
                <choice>
                    <text/>
                    <element>
                        <anyName>
                            <except>
                                <nsName/>
                            </except>
                        </anyName>
                        <ref name='anyThing'/>
                        <zeroOrMore>
                            <attribute>
                              <anyName/>
                            </attribute>
                        </zeroOrMore>
                    </element>
                </choice>
            </zeroOrMore>
            </define>
            
</grammar>