[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Two quick questions regarding restriction in XML Schema

  • To: "Murali Mani" <mani@C...>,"Eddie Robertsson" <erobertsson@a...>
  • Subject: RE: Two quick questions regarding restriction in XML Schema
  • From: "Dare Obasanjo" <dareo@m...>
  • Date: Fri, 17 May 2002 08:54:02 -0700
  • Cc: "Nada Reinprecht" <Nada_Reinprecht@n...>,<xml-dev@l...>
  • Thread-index: AcH9toR2s6yZwfGSQS6/ITCunXXqiwAAph3Y
  • Thread-topic: Two quick questions regarding restriction in XML Schema

invalid xsi type qname
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@C...] 
Sent: Fri 5/17/2002 8:18 AM 
To: Eddie Robertsson 
Cc: Nada Reinprecht; xml-dev@l... 
Subject: Re:  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>
	
	


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.