[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RelaxNG schema validation - wildcard attributes and ID types

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

RelaxNG schema validation - wildcard attributes and ID types
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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.