XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
[XSD question] Does ref'ing to the same global element declarationmultiple times violate the Don't Repeat Yourself principle?

Hi Folks,

Below is an XML Schema for a Bookstore. The Bookstore has any number of Books followed by any number of Magazines. Each Book has a Title and Publisher (and other things). Each Magazine also has a Title and Publisher (and other things). The Book element ref's to a globally declared Title element and ref's to a globally declared Publisher element. Ditto for the Magazine element. 

Title is declared once:

<xs:element name="Title" type="xs:string" />

but ref'ed twice (once from Book and once from Magazine): 

<xs:element ref="Title" />
<xs:element ref="Title" />

Ditto for Publisher.

Do multiple ref's to the same element constitute a violation of the Don't Repeat Yourself (DRY) principle?  /Roger
-----------------------------------------------
<xs:element name="Bookstore">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="Book" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element ref="Title" />
                        <xs:element ref="Publisher" />
                        ...
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="Magazine" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element ref="Title" />
                        <xs:element ref="Publisher" />
                        ...
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
</xs:element>

<xs:element name="Title" type="xs:string" />
<xs:element name="Publisher" type="xs:string" />
...


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


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS