• Beyond well- formedness
  • Beyond well- formedness
    • ➟ Motivation
<root>
  <bill amount="33.47"/> 

  <bill Amount="33.47"/>

  <Bill amount="20 bucks" />
</root>
Element bill = root.getChild("bill");
String a = bill.getAttributeValue("amount");
double amount = Double.parseDouble(a);
<html>
  <body> 
     <img source ="picture.png"/>
  </body>
  <heat> 
    <caption>Crappy HTML code</caption> 
  </heat>
</html>
Well-formed Valid (Grammar)
  • Arbitrary element / attribute names.

  • Arbitrary element nesting.

  • No data types e.g. <bill amount="sorry!"/>, <money>2026/08/11</money>.

  • Restrict allowed element / attribute names.

  • Restrict parent / child relations.

  • Element / attribute value types based on an extensible type scheme.

  • Beyond well- formedness
    • ➟ XML Schema
      • ➟ Structural descriptions for documents

Our

  • Objective: Modeling an address book and appointment database supporting an organizer application.

  • Starting point: A person's sample contact record.

<contact>
  <firstName>Eve</firstName>
  <lastName>Dexter</lastName>
  <email>dexter@company.com</email>
</contact>

Business rules:

  • Each contact must have the attributes firstName, lastName and email.

  • The order of these three values must be preserved.

A <contact>
[6] contact ::= '<contact>' firstName lastName email '</contact>'  
[7] firstName ::= '<firstName>' Text '</firstName>'  
[8] lastName ::= '<lastName>' Text '</lastName>'  
[9] email ::= '<email>' Text '</email>'  
[10] Text ::= [a-zA-Z0-9+-_*/...]*  
  • Beyond well- formedness
    • ➟ XML Schema
      • ➟ Element definitions
organizer.xsd myContacts.xml
<xs:element name="contact"> 
  <xs:complexType> 
    <xs:sequence> 
      <xs:element name="firstName"/> 
      <xs:element name="lastName"/>
      <xs:element name="email"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>
<contact
  xmlns:xsi=
    "http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="organizer.xsd" >
  <firstName>Eve</firstName>
  <lastName>Dexter</lastName>
  <email>dexter@company.com</email>
</contact>
<contact
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xsi:noNamespaceSchemaLocation  = "organizer.xsd"> 
  ...
</contact>
<contact
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="https://mi.hdm-stuttgart.de/organizer.xsd">
  ...
</contact>
> xmlparse -V  -s  myContacts.xml 
Parsing was successfull 
<contact xmlns:xsi=
   "http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="organizer.xsd">
  <firstName>Eve</firstName>
  <lastName>Dexter</lastName>
  <!-- no <email> here -->
</contact>
The content of element 'contact' is not complete. One of '{email}' is expected.
  • An XSD schema is itself an XML document.

  • XML documents may be valid with respect to a given XSD schema.

  • Compare multiple instances / single class relationship:

    // Multiple instances of class String
    String s1 = new String(), s2 = new String();
  • Machine readable, providing validation

layered SVG image
layered SVG image
layered SVG image
layered SVG image
  • Validating / non-validating: A non-validating parser checks for well- formedness. A validating parser in addition checks for schema compliance.

  • Valid / invalid documents: An XML document referencing a schema may either be valid or invalid with respect to the schema in question.

  • Document instance: If an XML document is valid with respect to a schema we call it an instance of the latter.

<xs:element name="contact">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="firstName"/>
      <xs:element name="lastName"/>
      <xs:element name="email" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>
<contact ...="organizer.xsd">
  <firstName>Eve</firstName>
  <lastName>Dexter</lastName>
  <!-- no <email> required here -->
</contact>
<xs:element name="organizer">
  <xs:complexType>
    <xs:sequence>
      <xs:element minOccurs="0" 
          maxOccurs="unbounded" 
          ref="contact"/> ━━━━┓ 
    </xs:sequence>            
  </xs:complexType>           
</xs:element>                 
<xs:element name="contact"> ◀━┛ 
  <xs:complexType>
    <xs:sequence>
        ...
      <xs:element name="email" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>
<organizer ...="organizer.xsd">
  <contact>
    <firstName>Eve</firstName>
    <lastName>Dexter</lastName>
  </contact>
  <contact>
    <firstName>Joe</firstName>
    <lastName>Simpson</lastName>
    <email>touching@the.void</email>
  </contact>
</organizer>
<xs:element name="organizer">
  <xs:complexType>
    <xs:sequence>
      <xs:element ref="contact"
        minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>
<xs:element name="contact">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="firstName"/>
      <xs:element name="lastName"/>
      <xs:element name="email" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>
<contact ...="organizer.xsd">
  <firstName>Eve</firstName>
  <lastName>Dexter</lastName>
  <email>dexter@company.com</email>
</contact>

Rule: Every schema element may be chosen as an instance's root.

Graphical schema representation
<xs:element name="contact">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="firstName"/>
      <xs:element name="lastName"/>
      <xs:element name="birthDate"
             minOccurs="0" maxOccurs="1"/>
      <xs:element name="email" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>
<contact ...="organizer.xsd">
  <firstName>Eve</firstName>
  <lastName>Dexter</lastName>

   <!-- valid though incomplete! -->
  <birthDate>1995-</birthDate>
</contact>
<xs:element name="contact">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="firstName"/>
      <xs:element name="lastName"/>
      <xs:element name="birthDate"
        type="xs:date"
        minOccurs="0" maxOccurs="1"/>
      <xs:element name="email"
          minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>
<organizer ...="organizer.xsd">
  <contact >
    ...
    <!-- '1995-11-39' is no valid value
        for 'date'. -->
    <birthDate>1995-11-39</birthDate>
  </contact>
  <contact>
    ...
    <!-- '21-st May 2004' is no valid
     value for 'date'. -->
    <birthDate>21-st May 2004</birthDate>
  </contact>
  • Zero or one <birthDate> per <contact>: No multivalued property.

  • No inner structure within <birthDate>.

Conclusion: Use a birthDate attribute rather than an element.

  • Beyond well- formedness
    • ➟ XML Schema
      • ➟ Attribute definitions
<xs:element name="contact">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="firstName"/>
      <xs:element name="lastName"/>
      <xs:element name="email"
          minOccurs="0"/>
    </xs:sequence>
    <xs:attribute name="birthDate"
      type="xs:date" use="optional"/>
  </xs:complexType>
</xs:element>
<contact ...="organizer.xsd"
  birthDate="1995-11-29">
  <firstName>Eve</firstName>
  <lastName>Dexter</lastName>
</contact>
<xs:element name="contact">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="firstName"/>
      <xs:element name="lastName"/>
      <xs:element name="email"
        minOccurs="0"/>
    </xs:sequence>
    <xs:attribute name="birthDate"
     type="xs:date" use="optional"/>
  </xs:complexType>
</xs:element>
<!-- birthDate is optional-->
<contact ...="organizer.xsd">
  <firstName>Eve</firstName>
  <lastName>Dexter</lastName>
</contact>
 attributes revisited
<contact ...="organizer.xsd">
  <firstName>Eve</firstName>
  <lastName>Dexter</lastName>

  <!-- Good idea, but no «real» email -->
  <email>dexter at my dot com</email>
</contact>
  • Basic validation desired.

  • No «email» data type in XSD.

  • Solution: User defined data type.

    Restrict an existing XML Schema type by a regular expression.

<xs:simpleType name="emailType" >
  <xs:restriction  base="xs:string"  >
    <xs:pattern value=
    "[_\-a-zA-Z0-9\.\+]+@[a-zA-Z0-9](\.?[\-a-zA-Z0-9]*[a-zA-Z0-9])*"/>
                                                                  
  </xs:restriction>
</xs:simpleType>

Even better: https://stackoverflow.com/questions/201323/how-to-validate-an-email-address-using-a-regular-expression

<xs:simpleType name="emailType" ◀━━━━┓ >
...value="[_\-a-zA-...0-9])*"/> ...  
</xs:simpleType>                     
                                     
<xs:element name="contact">          
  <xs:complexType>                   
    <xs:sequence>                    
    ...                              
      <xs:element name="email"       
    minOccurs="0" type="emailType" ━━┛ />
    </xs:sequence> ...
  </xs:complexType>
</xs:element>
<contact ...="organizer.xsd">
  <firstName>Eve</firstName>
  <lastName>Dexter</lastName>

  <!-- Value 'dexter at my dot com'
       is not facet-valid
       with respect to pattern
       '[_\-a-z...0-9])*'
        for type 'emailType'. -->
  <email>dexter at my dot com</email>
</contact>
<xs:element name="contact">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="firstName" />
      <xs:element name="lastName" />
      <xs:element name="email" .../>
    </xs:sequence>               ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    <xs:attribute                ┃  <contact ...="organizer.xsd">
       name="birthDate" .../>    ┃   <firstName>Eve <email>eve@y.com</email> </firstName>
  </xs:complexType>              ┃   <lastName>Dexter <pre>Gordon</pre>  </lastName>
</xs:element>                    ┃  </contact>
<xs:element name="contact">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="firstName" type="xs:string"/>
      <xs:element name="lastName" type="xs:string"/>
      <xs:element name="email" minOccurs="0" type="emailType"/>
    </xs:sequence>
    <xs:attribute name="birthDate" type="xs:date" use="optional"/>
  </xs:complexType>
</xs:element>
<contact xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="organizer.xsd"
  birthDate="1995-11-29">

  <!-- Wrong: type string -->
  <firstName>Eve <email>eve@paradise.com</email></firstName>
  <lastName>Dexter<p>Gordon</p></lastName>
</contact>
<-- @category may be either of:
      -friend
      -colleague
      -businessPartner        -->

<contact birthDate="1995-11-29"
  category="businessPartner">
  <firstName>Eve </firstName>
    <lastName>Dexter</lastName>
</contact>
<xs:simpleType name="contactCategoryType">
  <xs:restriction base="xs:string">  
    <xs:enumeration value="friend"/> ┗━━┓
    <xs:enumeration value="colleague"/> 
    <xs:enumeration                     
              value="businessPartner"/> 
  </xs:restriction>                     
</xs:simpleType>                        
                                        
<xs:element name="contact">             
  <xs:complexType>                      
    <xs:sequence> ...                   
    </xs:sequence>                      
    <xs:attribute name="birthDate"      
                 type="contactCategoryType"
                   use="optional"/>
  </xs:complexType>
</xs:element>
<contact
  category="author">
  <firstName>...
</contact>
Value 'author' is not
facet-valid with respect
to enumeration'
[friend, colleague,
  businessPartner]'...
<a 
href="https://my.com"
   >Some text</a>
  
         
         
 <!-- Just a string -->
<xs:element name="a">
  <xs:complexType>
    <xs:simpleContent>
      <xs:extension base="xs:string"> 
        <xs:attribute name="href" 
                   type="xs:anyURI"/> 
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
</xs:element>

The <a> element will contain pure text. This is being achieved by choosing <xs:simpleContent>.

The element requires an URL representing attribute <a href="..."> corresponding to xs:anyURI.

  • Beyond well- formedness
    • ➟ XML Schema
      • XPath and node sets
Query Result set
SELECT name, email
from Customer
WHERE dept='finance'
   or category = 12
{
  ('John Yates', 'yates@company.com'),
  ('Sandra Barnes', 'barnes@testcenter.org'),
...
}
  • XPath allows for predicate based queries on XML documents.

  • Result: Node set.

  • SQL DML equivalent.

  • Hierarchical queries extending flat SQL.

Predicate based queries:

SELECT name, email
from Customer
WHERE dept='finance'
   or category = 12
<database>
  ...
    <customer dept='finance'>...

</database>
/database//customer[@dept='finance'
        or category='7']

Predicate base queries:

SQL XPath
  • Predicate based queries using boolean algebra

  • Joins

  • Flat data

  • Hierarchical data support

  • Polymorphic results

layered SVG image
layered SVG image
layered SVG image
layered SVG image
layered SVG image
layered SVG image
layered SVG image

Starting from relative directory context:

find . -type d -name Gyre-P\*

Result:

./HTML-CSS/fonts/Gyre-Pagella
./SVG/fonts/Gyre-Pagella

Starting from absolute directory context:

find /etc/ -type f -and -name pac\*

Result:

/etc/brltty/Input/fs/pacmate.ktb
/etc/gnome-app-install/packages-whitelist
Context node <top>, XPath: b/a
<top>
  <b id="first">
    <a>One</a>
    <a>Two</a>
    <a>Three</a>
    <a>Four</a>
  </b>
  <c>Mixed<a>content></a>Example</c>
</top>
Context node <top>, XPath: b|c
<top>
  <b id="first">
    <a>One</a>
    <a>Two</a>
    <a>Three</a>
    <a>Four</a>
  </b>
  <c>Mixed<a>content></a>Example</c>
</top>
Context node <top>, XPath: (b|c)/a
<top>
  <b>
    <a>One</a>
    <a>Two</a>
    <a>Three</a>
    <a>Four</a>
  </b>
  <c>Mixed <a>content</a> Example</c>
</top>
//a
<top>
  <b>
    <a>One</a>
    <a>Two</a>
    <a>Three</a>
    <a>Four</a>
  </b>
  <c>Mixed <a>content</a> Example</c>
</top>
//a[2]
<top>
  <b>
    <a>One</a>
    <a>Two</a>
    <a>Three</a>
    <a>Four</a>
  </b>
  <c>Mixed<a>content></a>Example</c>
</top>
//a[1]
<top>
  <b>
    <a>One</a>
    <a>Two</a>
    <a>Three</a>
    <a>Four</a>
  </b>
  <c>Mixed<a>content></a>Example</c>
</top>
preceding-sibling::*

All nodes having the same parent node as the content node and appearing before the context node.

following-sibling::*

All nodes having the same parent node as the content node and appearing after the context node.

Before and after with respect to depth-first tree traversal.

Context node <a>Two</a>, XPath: following-sibling::*
<top>
  <b>
    <a>One</a>
    <a>Two</a>
    <a>Three</a>
    <x>Four</x>
    <a>Five</a>
  </b>
  <c>Mixed<a>content></a>Example</c>
</top>
layered SVG image
layered SVG image
layered SVG image
layered SVG image
layered SVG image
Context node <a>Two</a>, XPath: following-sibling::a
<top>
  <b>
    <a>One</a>
    <a>Two</a>
    <a>Three</a>
    <x>Four</x>
    <a>Five</a>
  </b>
  <c>Mixed<a>content></a>Example</c>
</top>
//*[text()[0 < string-length(normalize-space(.))]]
<top>
  <b id="first">
    <a>A house</a>
    <a>Rent a car</a>
    <a>Two houses</a>
    <a>Five</a>
  </b>
  <c>Building a house</c>
</top>
//*[text()[contains(., 'house')]]
<top>
  <b id="first">
    <a>A house</a>
    <a>Rent a car</a>
    <a>Two houses</a>
    <a>Five</a>
  </b>
  <c>Building a house</c>
</top>
//*[text()[7 < string-length(normalize-space(.))]]
<top>
  <b id="first">
    <a>A house</a>
    <a>Rent a car</a>
    <a>Two houses</a>
    <a>Five</a>
  </b>
  <c>Building a house</c>
</top>
//*[@id]
<top>
  <b id="start">
    <a>A house</a>
    <a>Rent a car</a>
    <a>Two houses    </a>
    <a>Five</a>
  </b>
  <c id="build">Building a house</c>
</top>
//*[@id='build']
<top>
  <b id="first">
    <a>A house</a>
    <a>Rent a car</a>
    <a>Two houses    </a>
    <a>Five</a>
  </b>
  <c id="build">Building a house</c>
</top>
//*[@id or @align='top']
<top>
    <a>
        <b id="5"/>
    </a>  
    <c align='middle'/>
    <e align='top'/>
</top>
  • Beyond well- formedness
    • ➟ XML Schema
      • ➟ Uniqueness Constraints
<contact nickname="Blue"> ◀───────┐
  <firstName>Eve</firstName> ...  
</contact>                         <!-- Error: Nicknames must be unique-->
                                  
<contact>  <!-- O.k.: Nickname    
               is optional-->     
  <firstName>Petra</firstName> ...
</contact>                        
                                  
<contact nickname="Blue"> ◀───────┘
  <firstName>Joe</firstName>...
</contact>
  • Optional nickname value.

  • Unique among all <contact> elements if present.

Relational databases: UNIQUE constraint.

CREATE TABLE Contact (
   ...
   nickname CHAR(10) NULL UNIQUE
...
)
<xs:element name="organizer">
...<xs:element ref="contact" .../>
       ...
...<xs:unique name="nicknameUnique"> 
     <xs:selector       xpath = "contact"/>
     <xs:field xpath="@nickname"/>   
  </xs:unique>             └──┐       
</xs:element> ...    ┌────────┼──────┘
                             
<xs:element name="contact">    
...  <xs:attribute name="nickname" .../>
  ...
</xs:element>
<contact nickname="Blue"> ◀────┐
  <firstName>Eve </firstName>  
  <lastName>Dexter</lastName>  
</contact>                     
                               
<!-- Invalid: Duplicate unique │
   value [Blue] ... -->        │
                               
<contact nickname="Blue"> ◀────┘
  <firstName>Joe</firstName>
  <lastName>Simpson</lastName>
</contact>
<contact id="123">
  <firstName>Joe</firstName>...
</contact>

<contact> <!-- Error: Missing @id-->
  <firstName>Joe</firstName>...
</contact>

<contact id="345">
  <firstName>Sue</firstName>...</contact>

<contact id="123"> <!-- Error: Duplicate @id value-->
  <firstName>Sue</firstName>...
</contact>
  • Required value.

  • Unique among all <contact> elements.

Relational databases: PRIMARY KEY or UNIQUE + NOT NULL constraint.

CREATE TABLE Contact (
   ...
   id INT PRIMARY KEY
...
)
<xs:element name="organizer">
... <xs:element ref="contact".../>
    ...
    <xs:key name="primaryKey">
      <xs:selector  xpath="contact"/>
      <xs:field  xpath="@id"/> 
    </xs:key>         ┌───┼────┘
</xs:element>            └───┐
<xs:element name="contact">   
...<xs:attribute       name="id"
    type="xs:int" use="optional" />
...
<!--
Invalid: Element "organizer"
has no value for the
key "primaryKey".
-->
<contact birthDate="1995-11-29"
    category="businessPartner"
    nickname="Blue">
  <firstName>Eve </firstName>
  <lastName>Dexter</lastName>
</contact>
<xs:element name="organizer">
... <xs:element ref="contact".../>
    ...
    <xs:key name="primaryKey">
      <xs:selector xpath="contact"/>
      <xs:field xpath="@id"/>
    </xs:key>
</xs:element>
<xs:element name="contact">
...<xs:attribute name="id"
    type="xs:int" use="required" />
...
<!-- 
Invalid: Element "organizer"
has no value for the
key "primaryKey". 
-->
<contact birthDate="1995-11-29"
      category="businessPartner"
      nickname="Blue">
  firstName>Eve </firstName>
  <lastName>Dexter</lastName>
</contact>
  • Beyond well- formedness
    • ➟ XML Schema
      • ➟ Referencing constraints
<contact id="10" >
    <firstName>Eve </firstName> ... </contact>
<contact id="11" > ◀─────────────────────────┐   
    <firstName>Joe</firstName>... </contact> 
<contact id="12" > ◀─────────────────────────┼─┐ 
    <firstName>Sue</firstName>... </contact> │ │ 
                                             │ │
<appointment date="2031-10-26T18:30:00">     │ │
    <description>Merry X-mas!</description>  │ │
    <participant>11</participant> ───────────┘ │ 
    <participant>12</participant> ─────────────┘ 
</appointment>
<contact id="10" >
    <firstName>Eve </firstName> ... </contact>
<contact id="11" >
    <firstName>Joe</firstName>... </contact>
<contact id="12" > ◀─────────────────────────┐ 
    <firstName>Sue</firstName>... </contact> 
<appointment date="2031-10-26T18:30:00">     
   <description>Merry X-mas!</description>   
   <participant>12</participant> ────────────┘ 
   <participant>123</participant>  ─────▶ ??
</appointment>
<xs:element name="organizer">
  <xs:complexType><xs:sequence> ...
     <xs:element ... maxOccurs="unbounded" ref="appointment"/>
...<xs:key name="primaryKey"> ◀─ reference          
   <xs:selector xpath="contact"/>                       
     <xs:field xpath="@id"/>                          
   </xs:key>                                          
   <xs:keyref name="participants" refer="primaryKey">  
     <xs:selector xpath="appointment/participant"/>    
     <xs:field xpath="."/>                            
    </xs:keyref>                          └────┐       
</xs:element>                                         
<xs:element name="appointment"> ◀──────────────┼───────┘
  <xs:complexType><xs:sequence>                
 ...  <xs:element type="xs:integer" name="participant"  
  <appointment date="2031-10-26T18:30:00">

    <description>Merry X-mas!</description>

    <participant>11</participant> ◀─
    <participant>12</participant>   
    <participant>11</participant> ◀─┘
  </appointment>
<xs:element name="appointment">
  <xs:complexType>
    <xs:sequence>
          ...
      <xs:element name="participant" type="xs:integer"
          maxOccurs="unbounded"/>
      </xs:sequence>
      ...
  </xs:complexType>

  <xs:key name="uniqueParticipants">
    <xs:selector xpath="participant"/>
    <xs:field xpath="."/>
  </xs:key>
</xs:element>
<appointment ...>

    <description>Merry X-mas!</description>

    <participant>11</participant> ◀─
    <participant>12</participant>   
                                     <!-- Duplicate key value [11]
                                          declared for identity
                                          constraint "uniqueParticipants"
                                          of element "appointment". -->
    <participant>11</participant> ◀─┘
</appointment>
Representing extended <memo> instances
  • Beyond well- formedness
    • ➟ XML Schema
      • ➟ Best practices
<xs:element name="organizer">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="contact"
         minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="firstName"/>
            <xs:element name="lastName"/>
            <xs:element name="email" 
                           minOccurs="0"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
</xs:element>
<xs:element name="organizer">
  <xs:complexType>
    <xs:sequence>
      <xs:element ref="contact"
            minOccurs="0"
            maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>
<xs:element name="contact">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="firstName"/>
      <xs:element name="lastName"/>
      <xs:element name="email"
              minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>
Common pitfalls
<xs:element name="top" />
<!-- Valid instance! -->
<top ...="problem1.xsd">  
  <p>Weird <b>text</b></p>
</top>
<xs:element name="top"
   type="xs:string" />
<!-- Element 'top' is a simple type,
   so it must have no element
   information item [children]. -->
<top ...="problem.xsd">  
  <p>Weird <b>text</b></p>
</top>
<xs:element name="top">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="para"/> 
    </xs:sequence>
  </xs:complexType>
</xs:element>
    
<xs:element name="para" 
    type="xs:int"/>
<top ="problem2.xsd">
  <!-- Expected type int -->
  <para>1234</para>

  <!-- Non-expected mixed content -->
  <para><emphasis>Just</emphasis> a string</para>
</top>
layered SVG image
layered SVG image
layered SVG image
layered SVG image
layered SVG image
layered SVG image
layered SVG image
layered SVG image
  • Beyond well- formedness
    • ➟ XML Schema
      • ➟ Dealing with <memo> documents
<memo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:noNamespaceSchemaLocation="memo.xsd" >
    <from>M. Goik</from>
    <to>B. King</to>
    <to>A. June</to>
    <subject>Best whishes</subject>
    <content>Hi all, congratulations to your splendid party</content>
</memo>
Validation of memo document instances.
  • Beyond well- formedness
layered SVG image
layered SVG image
layered SVG image
layered SVG image
layered SVG image
layered SVG image
layered SVG image
layered SVG image
layered SVG image
layered SVG image
layered SVG image
layered SVG image
  1. An XML schema representing invoices
  2. Airline meta information by XML schema
  • Beyond well- formedness
    • ➟ XML Schema
layered SVG image
layered SVG image
layered SVG image
layered SVG image
  1. Product catalog schema
  2. A schema for editing books
  3. Book documents with mixed content and itemized lists
  4. book.xsd and languages
  5. Supporting <table> and internal references in book.xsd.