RE: [Updated] XML Schema 1.1 Tutorial

 
Thanks Noah and Michael. I made the suggested changes. See slides 27-28:

http://www.xfront.com/xml-schema-1-1/xml-schema-1-1.ppt

/Roger

> -----Original Message-----
> From: noah_mendelsohn@us.ibm.com [mailto:noah_mendelsohn@us.ibm.com] 
> Sent: Wednesday, July 29, 2009 4:04 PM
> To: Costello, Roger L.
> Cc: xmlschema-dev@w3.org
> Subject: Re: [Updated] XML Schema 1.1 Tutorial
> 
> On Slide 27, you say:
> 
> "With XML Schema 1.0 you could not restrict a type defined in another 
> schema. In XML Schema 1.1 you can by adding a targetNamespace 
> attribute to 
> each element and attribute in the restriction"
> 
> I think it would be more accurate to say:]
> 
> "A  XSD 1.0 Schema Document with one targetNamespace could 
> not restrict a 
> type using elements from another targetNamespace.  In XML 
> Schema 1.1, you 
> can do this, by adding a targetNamespace attribute to each 
> such "foreign" 
> element and attribute in the restriction"
> 
> Reasons for the corrections:
> 
> * Neither XSD 1.0 nor XSD 1.1 speak directly about 
> restrictions across 
> "schemas". 
> 
> * Schema documents are the standard way of setting down schema 
> information, but not the only possible way (APIs might be 
> another.)  As 
> far as I know, there's nothing in XSD 1.0 that would prevent such 
> cross-targetNamespace restriction using representations other 
> than Schema 
> Documents.  The issue is:  schema documents (I.e. the 
> standard XML form 
> for writing down a schema) lacked the capability.  XSD 1.1 allows it.
> 
> * You only need to supply the targetNamespace if the elements 
> happen to be 
> foreign (foreign is not a formal term, but I hope it's clear 
> for purposes 
> of this note.  Although it wouldn't come up in the simplest 
> cases, one can 
> imagine a case in which some of the elements were in fact from the 
> targetNamespace of the schema document, and for those no 
> targetNamespace 
> would be needed.
> 
> Actually, looking at your example, I think it lacks important prefix 
> definitions.  I think this would be clearer.  This defines a type 
> lib:BookInLibrary based on books:Book:
> 
> <xs:schema      targetNamespace="http://www.libraries.org"
>                 xmlns:books="Book.xsd">
>     <xs:import namespace="http://www.book.org"
>                   schemaLocation="Book.xsd"/>
> 
>     <xs:complexType name="BookInLibrary">
>         <xs:complexContent>
>             <xs:restriction base="books:Book">
>                 <xs:sequence>
>                     <xs:element name="Title" type="xs:string" 
>  targetNamespace="http://www.book.org"/>
>                     <xs:element name="Author" type="xs:string" 
> maxOccurs="2" 
>  targetNamespace="http://www.book.org"/>
>                     <xs:element name="Date" type="xs:gYear" 
>  targetNamespace="http://www.book.org"/>
>                     <xs:element name="ISBN" type="xs:string" 
>  targetNamespace="http://www.book.org"/>
>                     <xs:element name="Publisher" type="xs:string" 
>  targetNamespace="http://www.book.org"/> 
>                 </xs:sequence>
>             </xs:restriction>
>         </xs:complexContent>
>     </xs:complexType> 
> </xs:schema>
> 
> 
> --------------------------------------
> Noah Mendelsohn 
> IBM Corporation
> One Rogers Street
> Cambridge, MA 02142
> 1-617-693-4036
> --------------------------------------
> 
> 
> 
> 
> 
> 
> 
> 
> "Costello, Roger L." <costello@mitre.org>
> Sent by: xmlschema-dev-request@w3.org
> 07/24/2009 02:16 PM
>  
>         To:     "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
>         cc:     (bcc: Noah Mendelsohn/Cambridge/IBM)
>         Subject:        [Updated] XML Schema 1.1 Tutorial
> 
> 
> 
> Hi Folks,
> 
> I updated my XML Schema 1.1 Tutorial:
> 
> http://www.xfront.com/xml-schema-1-1/xml-schema-1-1.ppt
> 
> Here are the changes:
> 
> 1. At the beginning I added a "5 minute intro" section that 
> quickly covers 
> all of the new capabilities in XML Schema 1.1
> 
> 2. I completely revised the section on targetNamespace 
> (thanks to Michael 
> Kay and Michael Sperberg-McQueen for straightening me out)
> 
> 3. I added a few more slides on xs:error
> 
> Thanks to Noah and Mukul for their suggestions.
> 
> I will be announcing the tutorial on xml-dev shortly.
> 
> /Roger
> 
> 
> 

Received on Wednesday, 29 July 2009 22:24:22 UTC