[Home] [By Thread] [By Date] [Recent Entries]

  • From: Svante Schubert <Svante.Schubert@S...>
  • To: xml-dev@l...
  • Date: Tue, 09 Oct 2007 19:53:35 +0200

When a RelaxNG schema uses a wildcard for attributes together with 
ID/IDREF/IDREFS attributes (cp. schema example in the end), the 
validation of the schema fails using oNVDL integrated by OxygenXML with 
the error message that the there are conflicting ID types.

The reason has been discussed earlier, e.g.
     http://tech.groups.yahoo.com/group/rng-users/message/751

The question is, does the tool have to act this way due to a specification?

The most relevant spec seems to be:
    http://www.oasis-open.org/committees/relax-ng/compatibility.html#id
But although I might misinterpret
    
http://www.oasis-open.org/committees/relax-ng/compatibility.html#IDAMYYR
I would say no.

The workaround is to exclude all existing ID typed attributes that 
appear in the schema from the attribute wildcard
For instance in an "any" element part of the example below, the ID has 
to be excluded:

<define name="any">
    <zeroOrMore>
        <choice>
            <element>
                <anyName/>
                <zeroOrMore>
                    <attribute>
                        <anyName>
                            <except>
                                <name ns="urn:example-one">id</name>
                            </except>
                        </anyName>
                    </attribute>
                </zeroOrMore>
                <ref name="any"/>
            </element>
            <text/>
        </choice>
    </zeroOrMore>
</define>


But what if the test:id attribute should be used in this arbitrary content?
Does not "anyAttributes" refer to external attributes as well? It seems 
strange that only the internal IDs are being checked and why doing this 
check at all?
It is odd to add an exclude to every attribute/anyName of a Schema, 
whenever a ID type attribute is being added.

Curious to hear your opinion on that..

Final a full schema example using arbitrary elements and an ID:

<grammar xmlns="http://relaxng.org/ns/structure/1.0" 
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" 
xmlns:test="urn:example-one">
    <start>
        <ref name="root"/>
    </start>
    <define name="root">
        <element name="test:root">
            <ref name="anchor"/>
            <ref name="any"/>
        </element>
    </define>
    <define name="anchor">
        <element name="test:anchor">
            <optional>
                <attribute name="test:id">
                    <data type="ID"/>
                </attribute>
            </optional>
            <text/>
        </element>
    </define>
    <define name="any">
        <zeroOrMore>
            <choice>
                <element>
                    <anyName/>
                    <zeroOrMore>
                        <attribute>
                            <anyName/>
                        </attribute>
                    </zeroOrMore>
                    <ref name="any"/>
                </element>
                <text/>
            </choice>
        </zeroOrMore>
    </define>
</grammar>

Regards,
Svante


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member