XML
  Home arrow XML arrow Page 3 - Designing Your own XML Schema: Learn the E...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Moblin 
JMSL Numerical Library 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
XML

Designing Your own XML Schema: Learn the Essentials
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 13
    2006-03-06

    Table of Contents:
  • Designing Your own XML Schema: Learn the Essentials
  • XML Schema: beginning with the simplest way
  • XML Schema: the complex way
  • XML Schema: a simple practical example
  • XML Schema: a simple practical example continued
  • XML Schema: a more practical example

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Designing Your own XML Schema: Learn the Essentials - XML Schema: the complex way


    (Page 3 of 6 )

    The previous section covered defining the schema in a very simple manner with simple data types.  Now, we need to extend this to “complex” types.

    “Simple” types are generally used for defining simple XML structures of some standard data types.  As your schema grows with several other complicated structures (and might even be nested within them), the “simple” types may not be quite enough to handle the entire schema accurately.

    Complicated structures generally include nested structures, relations between structures, attributes, links to other structures in external schemas, and so on.  All these complications cannot be handled by “simple” types at all.  This requires the  “complex” type of declarations.

    Let us start with a tiny “complex” type XSD declaration:

    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
          <xs:element name="Employees">
                <xs:annotation>
                      <xs:documentation>Contains All Employee information</xs:documentation>
                </xs:annotation>
                <xs:complexType/>
          </xs:element>
    </xs:schema>

    The above defines a new root element, “Employees,” as a complex type (but doesn't yet define what type or how complex it is).  The “annotation” is generally used for documenting your definition.  Though it is optional, it is a good practice to maintain “documentation” with every definition.  This would also help other users (or consumers) of several other heterogeneous environments to understand your schema better.

    Even though the above schema is not very useful, I just meant it for a simple example.  Let us now look into more practical scenarios.

    More XML Articles
    More By Jagadish Chaterjee


       · Hello guys, you can learn easily XML schema from this series. Have a look at it and...
     

    XML ARTICLES

    - Datatypes and More in RELAX NG
    - Providing Options in RELAX NG
    - An Introduction to RELAX NG
    - Path, Predicates, and XQuery
    - Using Predicates with XQuery
    - Navigating Input Documents Using Paths
    - XML Basics
    - Introduction to XPath
    - Simple Web Syndication with RSS 2.0
    - Java UI Design with an IDE
    - UI Design with Java and XML Toolkits
    - Displaying ADO Retrieved Data with XML Islan...
    - Widget Walkthrough
    - Introduction to Widgets
    - The Why and How of XML Data Islands







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway