OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Two quick questions regarding restriction in XML Schema

[ Lists Home | Date Index | Thread Index ]

Hi Murali,

> I have one question regarding extension:
> can we define the following types
> type Book -> (Title, Author+)
> type Book1 extends Book -> (Title, Author+, Title)

Yes, this is valid. However, it's important to remember that when extending an element in
W3C XML Schema you actually sequence the old content model together with the new one so
the correct (DTD equivalent) of the above extension would actually be:

type Book1 extends Book -> ((Title, Author+), Title))

In this case it doesn't matter much but say you have the following type:

type Contact -> (Email | Phone)

and you want to extend this choice type with a new element Fax. The new derived type would
actually be:

type Contact1 -> ((Email | Phone)), Fax)

Cheers,
/Eddie

>
>
> Note: If the above type definitions are valid, then I am afraid, there is
> a problem with the framework of subsumption. I think subsumption will be
> able to capture only restricted subset of extensions allowed in W3C's
> XML-Schema. I am quite confident of my conclusions. (The above extension
> cannot be captured using subsumption)
>
> thanks and regards - murali.
>
> On Fri, 17 May 2002, Dare Obasanjo wrote:
>
> > From the little I know of W3C XML Schema, the answer to all your questions is Yes.
> >
> > I'd love to read this report when you are done with it. Will it be online somewhere?
> >
> >       -----Original Message-----
> >       From: Murali Mani [mailto:mani@CS.UCLA.EDU]
> >       Sent: Fri 5/17/2002 9:13 AM
> >       To: Dare Obasanjo
> >       Cc: Eddie Robertsson; Nada Reinprecht; xml-dev@lists.xml.org
> >       Subject: RE: [xml-dev] Two quick questions regarding restriction in XML Schema
> >
> >
> >
> >
> >       My question was this:
> >       We have type definitions,
> >
> >       type Book (block="restriction") -> (Title, Author*)
> >       type Book1 restricts Book -> (Title, Author, Author)
> >
> >       and element declaration
> >       <element book type="Book">
> >
> >       So which of the two following documents are valid?:
> >       <book>
> >           <title>XYZ</title>
> >           <author>ABC</author>
> >           <author>DEF</author>
> >       </book>
> >
> >       and
> >
> >       <book xsi:type="Book1">
> >           <title>XYZ</title>
> >           <author>ABC</author>
> >           <author>DEF</author>
> >       </book>
> >
> >       I think the answer is the first document is valid, whereas the second one
> >       is not, because of the reason which Dare gives second. This is clear.
> >
> >       Now, one more question on restriction:
> >
> >       suppose we defined
> >       type Book (final="restriction") -> Title, Author*
> >       now we cannot define type Book1 as above, correct??
> >
> >       also let us assume the element declaration as above
> >       <element book type="Book">
> >
> >       Consider the following document:
> >       <book>
> >           <title>XYZ</title>
> >           <author>ABC</author>
> >           <author>DEF</author>
> >       </book>
> >
> >       The above document is valid, right?
> >
> >       I will tell you what I am trying to understand: "I have seen two
> >       frameworks trying to explain subtyping in XML - one is in XDuce using
> >       inclusion, and other is a framework known as subsumption. I am trying to
> >       analyze them. These questions help me in understanding. I am presently
> >       writing a "short" report (presently 6 pages, I believe it will be less
> >       than 10 pages) analyzing the various subtyping schemes for XML."
> >
> >       thanks and regards - murali.
> >
> >       On Fri, 17 May 2002, Dare Obasanjo wrote:
> >
> >       > The validity first document is valid while the second isn't but not
> >       > for the reasons you suppose. The second one is invalid because no type
> >       > definition exists for a type named "Book1". :)
> >       >
> >       >  However, assuming that a Book1 type one existed and it was a valid
> >       > restriction of Book then you are correct that the document is invalid.
> >       > According to
> >       >
> >       >  Validation Rule: Element Locally Valid (Element) [0] 4 If there is an
> >       > attribute information item among the element information item's
> >       > [attributes] <http://www.w3.org/TR/xml-infoset/#infoitem.element>
> >       > whose [namespace name]
> >       > <http://www.w3.org/TR/xml-infoset/#infoitem.attribute> is identical to
> >       > http://www.w3.org/2001/XMLSchema-instance and whose [local name]
> >       > <http://www.w3.org/TR/xml-infoset/#infoitem.attribute> is type, then
> >       > all of the following must be true:  4.1 The ·normalized value· of
> >       > that attribute information item must be ·valid· with respect to the
> >       > built-in QName
> >       > <http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes#QName>
> >       > simple type, as defined by String Valid (§3.14.4);  4.2 The ·local
> >       > name· and ·namespace name· (as defined in QName Interpretation
> >       > (§3.15.3)), of the ·actual value· of that attribute information
> >       > item must resolve to a type definition, as defined in QName resolution
> >       > (Instance) (§3.15.4) -- [Definition:] call this type definition the
> >       > local type definition; 4.3 The ·local type definition· must be
> >       > validly derived from the {type definition} given the union of the
> >       > {disallowed substitutions} and the {type definition}'s {prohibited
> >       > substitutions}, as defined in Type Derivation OK (Complex) (§3.4.6)
> >       > (if it is a complex type definition), or given {disallowed
> >       > substitutions} as defined in Type Derivation OK (Simple) (§3.14.6)
> >       > (if it is a simple type definition).
> >       >
> >       > [0] http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#cvc-elt
> >
> >
> >
> >
> >





 

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

Copyright 2001 XML.org. This site is hosted by OASIS