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]
Re: [xml-dev] XML Schema Design: no local elements with anonymous types

Well that's the way I build all my schemas but I don't agree with your
conclusions for the following reasons:

1. I don't think it is a good idea to mandate how your validation
layer should be designed in order to allow it to tie in better with
other layers.
2. It's been my experience that with my preferred method that
debugging and maintainability of the schema is sometimes adversely
affected. YMMV.
3. There is a tendency to say that if we have two elements named
Address we will say that they are both the AddressType. This is not
always the best way to do it, and having global elements and types of
course enables this the tendency (in the sense of an 'enabler' or a
bad habit.)
4. In XML Schema 1.0 there is no way to specify which global element
is the document element, this leads to the bad design (I think) of
structures like this:
<f:FinancialStatement xmnls:f="http://www.example.org/example1";
xmnls:f2="http://www.example.org/example2";>
<f2:FinancialStatementAuthor></f2:FinancialStatementAuthor>
....
</f:FinancialStatement>

where the f namespace imports the f2 namespace and documents to be
validated are in the f namespace, thus as there is only one element in
the f namespace there is a de facto document element.

of course it is my recollection that this will be changed in XML
Schema 1.1 so that is only a temporary quibble.

Anyway I think my main objection is I don't want to see best practices
in a technology based on making it work best with some other
technology, unless it is a more targeted best practice for that exact
purpose. This of course is different than noting what parts of a
particular technology make it a poor fit for working with others.

Cheers,
Bryan Rasmussen


On Wed, Mar 26, 2008 at 12:17 PM, Costello, Roger L. <costello@mitre.org> wrote:
> Hi Folks,
>
>  Along the road to learning version 2.0 of XSLT/XPath, I learned this
>  about designing XML Schemas.
>
>  BAD: locally declared elements with anonymous types.
>
>  Example:  NumPages is BAD because it is locally declared and has an
>  anonymous type.
>
>  <element name="Book">
>     <complexType>
>         <sequence>
>           <element name="NumPages">
>                <simpleType>
>                      <restriction base="positiveInteger">
>                          <maxInclusive value="1200"/>
>                      </restriction>
>                </simpleType>
>           </element>
>         </sequence>
>     </complexType>
>  </element>
>
>  GOOD: globally declared elements and/or elements with a named type.
>
>  Example: Now NumPages is GOOD because it is globally declared and has a
>  named type.
>
>  <element name="Book">
>     <complexType>
>         <sequence>
>           <element ref="bk:NumPages"/>
>         </sequence>
>     </complexType>
>  </element>
>
>  <element name="NumPages" type="NumPagesType" />
>
>  <simpleType name="NumPagesType">
>     <restriction base="positiveInteger">
>         <maxInclusive value="1200"/>
>     </restriction>
>  </simpleType>
>
>
>  Here's why: XSLT/XPath 2.0 is "schema-aware."  That is, in a 2.0
>  stylesheet you can take advantages of the type information in the
>  schema.  However, that's true only if the elements are declared
>  globally and/or with a named type.  So, to facilitate the use of type
>  information by a 2.0 stylesheet, design your XML Schemas such that
>  elements are declared globally and/or with a named type.
>
>  Summary: make the element global, or with a named type, or both.
>
>  /Roger
>
>  _______________________________________________________________________
>
>  XML-DEV is a publicly archived, unmoderated list hosted by OASIS
>  to support XML implementation and development. To minimize
>  spam in the archives, you must subscribe before posting.
>
>  [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
>  Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
>  subscribe: xml-dev-subscribe@lists.xml.org
>  List archive: http://lists.xml.org/archives/xml-dev/
>  List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
>
>


[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