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 ]

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 
 
-----Original Message----- 
From: Murali Mani [mailto:mani@CS.UCLA.EDU] 
Sent: Fri 5/17/2002 8:18 AM 
To: Eddie Robertsson 
Cc: Nada Reinprecht; xml-dev@lists.xml.org 
Subject: Re: [xml-dev] Two quick questions regarding restriction in XML Schema




	thanks, that clears things up. Can I ask one more question:
	Suppose we defined type Book as (we define block has value restriction)
	
	type Book (block="restriction") -> (Title, Author*)
	
	and the remaining definitions for type Book1, as well as the element
	declaration for element book stay the same.
	
	Now, again consider the two documents:
	<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>
	
	Is it true that the first document is valid, whereas the second document
	is invalid??
	
	thanks and regards - murali.
	
	On Fri, 17 May 2002, Eddie Robertsson wrote:
	
	> Hi,
	>
	> > type Book -> (Title, Author*)
	> > type Book1 restricts Book -> (Title, Author, Author)
	> >
	> > (in other words, Book1 is for Books with exactly two Authors)
	> >
	> > Now suppose we declare an element as
	> >
	> > <element book type="Book">
	> >
	> > and in the document however we want to use type Book1, how do we say that?
	> >
	> > Do we say
	> > <book>
	> >    <title>XYZ</title>
	> >    <author>ABC</author>
	> >    <author>DEF</author>
	> > </book>
	>
	> No, this will use the type "Book".
	>
	> > or do we say
	> > <book xsi:type="Book1">
	> >     <title>XYZ</title>
	> >    <author>ABC</author>
	> >    <author>DEF</author>
	> > </book>
	>
	> Yes, this will use the type "Book1" so if you do:
	>
	> <book xsi:type="Book1">
	>     <title>XYZ</title>
	>    <author>ABC</author>
	>    <author>DEF</author>
	>    <author>EDF</author>
	> </book>
	>
	> you will receive a validation error.
	>
	> > I think it should be the latter?
	>
	> Correct.
	>
	> Cheers,
	> /Eddie
	>
	
	
	-----------------------------------------------------------------
	The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
	initiative of OASIS <http://www.oasis-open.org>
	
	The list archives are at http://lists.xml.org/archives/xml-dev/
	
	To subscribe or unsubscribe from this list use the subscription
	manager: <http://lists.xml.org/ob/adm.pl>
	
	





 

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

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