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 ]


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