11. Referencing Schemas And Schema Datatypes in XML Documents (samples)

Sample 1

http://www.w3.org/2001/XMLSchema-instance

Sample 2

xsi

Sample 3

http://my.netscape.com/publish/formats/rss-0.91.dtd

Sample 4

 
  <library xsi:noNamespaceSchemaLocation="first.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    .../...
  </library>

													 
									 

Sample 5

[download]

<?xml version="1.0"?> 
<book id="b0836217462" xmlns="http://dyomedea.com/ns/library"
  xmlns:mkt="http://dyomedea.com/ns/library/mkt">
  <title>
    Being a Dog Is a Full-Time Job
  </title>
  <author>
    Charles M Schulz
  </author>
  <mkt:cover>
    Paperback
  </mkt:cover>
  <mkt:pages>
    128
  </mkt:pages>
</book>

Sample 6

[download]

<?xml version="1.0"?> 
<xs:schema targetNamespace="http://dyomedea.com/ns/library"
  elementFormDefault="qualified" attributeFormDefault="unqualified"
  xmlns:lib="http://dyomedea.com/ns/library"
  xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="book">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="title" type="xs:token"/> 
        <xs:element name="author" type="xs:token"
          maxOccurs="unbounded"/> 
        <xs:any namespace="##other" processContents="lax"
          minOccurs="0"maxOccurs="unbounded"/>
      </xs:sequence>
      <xs:attribute name="id" type="xs:ID"/>
    </xs:complexType>
  </xs:element>
</xs:schema>

Sample 7

[download]

<?xml version="1.0"?> 
<xs:schema targetNamespace="http://dyomedea.com/ns/library/mkt"
  elementFormDefault="qualified" attributeFormDefault="unqualified"
  xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="cover" type="xs:NMTOKEN"/>
  <xs:element name="pages" type="xs:nonNegativeInteger"/>
</xs:schema>

Sample 8

http://dyomedea.com/ns/library

Sample 9

[download]

<?xml version="1.0"?> 
<book xsi:schemaLocation="http://dyomedea.com/ns/library library.xsd"
  id="b0836217462" xmlns="http://dyomedea.com/ns/library"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:mkt="http://dyomedea.com/ns/library/mkt">
  <title>
    Being a Dog Is a Full-Time Job
  </title>
  <author>
    Charles M Schulz
  </author>
  <mkt:cover>
    Paperback
  </mkt:cover>
  <mkt:pages>
    128
  </mkt:pages>
</book>

Sample 10

"http://dyomedea.com/ns/library library.xsd"

Sample 11

[download]

<?xml version="1.0"?> 
<book id="b0836217462"
  xsi:schemaLocation="http://dyomedea.com/ns/library library.xsd"
  xmlns="http://dyomedea.com/ns/library"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:mkt="http://dyomedea.com/ns/library/mkt">
  <title>
    Being a Dog Is a Full-Time Job
  </title>
  <author>
    Charles M Schulz
  </author> 
  <mkt:cover xsi:schemaLocation="http://dyomedea.com/ns/library/mkt
    marketing.xsd">
    Paperback
  </mkt:cover>
  <mkt:pages>
    128
  </mkt:pages>
</book>

Sample 12

[download]

<?xml version="1.0"?> 
<book id="b0836217462"
  xsi:schemaLocation="http://dyomedea.com/ns/library library.xsd
  http://dyomedea.com/ns/library/mkt marketing.xsd"
  xmlns="http://dyomedea.com/ns/library"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:mkt="http://dyomedea.com/ns/library/mkt">
  <title>
    Being a Dog Is a Full-Time Job
  </title>
  <author>
    Charles M Schulz
  </author>
  <mkt:cover>
    Paperback
  </mkt:cover>
  <mkt:pages>
    128
  </mkt:pages>
</book>

Sample 13

[download]


  <xs:simpleType name="dateISO">
    <xs:restriction base="xs:date">
      <xs:pattern value="[^:Z]*"/>
    </xs:restriction>
  </xs:simpleType>

Sample 14




  <xs:simpleType name="EnglishDate">
    <xs:restriction base="xs:token"> 
      <xs:pattern
        value="(January|March|May|July|August|October|December)
        ([23]?1st|2?(2nd|3rd)|(1[123]|30|[12]?[4-9])th),\d{0,4}"/> 
      <xs:pattern value="February
        (2?(1st|2nd|3rd)|(1[123]|[12]?[4-9])th),\d{0,4}"/> 
      <xs:pattern value="(April|June|September|November)
        (2?(1st|2nd|3rd)|(1[123]|30|[12]?[4-9])th),\d{0,4}"/>
    </xs:restriction>
  </xs:simpleType>



Sample 15

[download]


  <xs:simpleType name="EnglishDate">
    <xs:restriction base="xs:token"> 
      <xs:pattern
        value="(January|March|May|July|August|October|December)
        ([1-3]?1st|[12]?2nd|[12]?3rd|(30|[12]?[4-9])th),[0-9]{0,4}"/> 
      <xs:pattern value="February
        ([1-2]?1st|[12]?2nd|[12]?3rd|[12]?[4-9]th),[0-9]{0,4}"/> 
      <xs:pattern value="(April|June|September|November)
        ([1-2]?1st|[12]?2nd|[12]?3rd|(30|[12]?[4-9])th),[0-9]{0,4}"/>
    </xs:restriction>
  </xs:simpleType>

Sample 16




  <xs:simpleType name="dateFran?aise">
    <xs:restriction base="xs:token"> 
      <xs:pattern value="(1er|[1-3][01]|[12]?[2-9])
        (janvier|mars|mai|juillet|ao?t|octobre|d?cembre)\d{0,4}"/>
      <xs:pattern value="(1er|[12][01]|[12]?[2-9]) f?vrier \d{0,4}"/> 
      <xs:pattern value="(1er|[12][01]|[12]?[2-9]|30)
        (avril|juin|septembre|novembre)\d{0,4}"/>
    </xs:restriction>
  </xs:simpleType>



Sample 17

[download]



Sample 18

[download]


  <xs:simpleType name="anyDate">
    <xs:union memberTypes="dateISO EnglishDate dateFrançaise"/>
  </xs:simpleType>

Sample 19


  <methodCall>
    <methodName>
      examples.getStateName
    </methodName>
    <params>
      <param>
        <value>
          <i4>
            41
          </i4>
        </value>
      </param>
    </params>
  </methodCall>

							

Sample 20

 
							

  <methodCall xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <methodName>
      examples.getStateName
    </methodName>
    <params>
      <param>
        <value xsi:type="xs:int">
          41
        </value>
      </param>
    </params>
  </methodCall>

Sample 21

	
 
  <cost xsi:type="xs:float"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    29.95
  </cost>

Sample 22

	
 
  <book id="b0836217462" available="true" title="Being a Dog Is a
    Full-TimeJob">
    .../...
  </book>

Sample 23


  <book id="b0836217462" available="true" type="bookTitleElements">
    <isbn>
      0836217462
    </isbn>
    <title lang="en">
      Being a Dog Is a Full-Time Job
    </title>
    <title lang="fr">
      Etre un chien est un travail à plein temps.
    </title>
    .../...
  </book>

Sample 24


  <xs:complexType name="bookBase">
    <xs:sequence>
      <xs:element ref="isbn"/>
      <xs:element ref="title" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="author" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="character" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="id"/>
    <xs:attribute ref="title"/>
    <xs:attribute ref="available"/>
  </xs:complexType>

Sample 25


  <xs:complexType name="bookTitleAttribute">
    <xs:complexContent>
      <xs:restriction base="bookBase">
        <xs:sequence>
          <xs:element ref="isbn"/> 
          <xs:element ref="author" minOccurs="0"
            maxOccurs="unbounded"/> 
          <xs:element ref="character" minOccurs="0"
            maxOccurs="unbounded"/>
        </xs:sequence>
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>

Sample 26


  <xs:complexType name="bookTitleElements">
    <xs:complexContent>
      <xs:restriction base="bookBase">
        <xs:sequence>
          <xs:element ref="isbn"/>
          <xs:element ref="title" minOccurs="1" maxOccurs="unbounded"/> 
          <xs:element ref="author" minOccurs="0"
            maxOccurs="unbounded"/> 
          <xs:element ref="character" minOccurs="0"
            maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute ref="title" use="prohibited"/>
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>

Sample 27


  <xs:element name="book" type="bookBase"/>

Sample 28


  <book id="b0836217462" available="true" type="bookTitleElements">
    <isbn>
      0836217462
    </isbn>
    <title lang="en">
      Being a Dog Is a Full-Time Job
    </title>
    <title lang="fr">
      Etre un chien est un travail à plein temps.
    </title>
    .../...
  </book>

Sample 29

 
  <book id="b0836217462" available="true" title="Being a Dog Is a
    Full-TimeJob" type="bookTitleAttribute">
    .../...
  </book>

Sample 30

[download]


  <xs:complexType name="bookBase" abstract="true">
    <xs:sequence>
      <xs:element ref="isbn"/>
      <xs:element ref="title" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="author" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="character" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="id"/>
    <xs:attribute ref="title"/>
    <xs:attribute ref="available"/>
  </xs:complexType>

Sample 31

[download]


  <xs:element name="author" nillable="true">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="name"/>
        <xs:element ref="born"/>
        <xs:element ref="dead" minOccurs="0"/>
      </xs:sequence>
      <xs:attribute ref="id"/>
    </xs:complexType>
  </xs:element>

Sample 32


							
 
  <author xsi:nil="true"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
							
			

Sample 33


							
 
  <author xsi:nil="true"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
							
			

Sample 34


							

  <author/>