Skip to main content
IBM  
Shop Support Downloads
IBM Home Products Consulting Industries News About IBM
IBM developerWorks : XML : Education - Tutorials
XML Schema Infoset Model, Part 2
ZIPPDF (letter)PDF (A4)e-mail
Main menuSection menuFeedbackNext
2. Overview of XML Schema documents
  


Schema as a whole page 1 of 5


The <schema> element is the root element of every XML Schema document:


        <?xml version="1.0"?> 
        <xsd:schema> 
        ... 
        ... 
        </xsd:schema> 
        

The <schema> element may contain some attributes, which are described in XML Schema Part 1: Structures of the standard. A typical schema declaration often looks something like this:

 
<?xml version="1.0"?>
<xsd:schema 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.eclipse.org/xsd/examples"
xmlns="http://www.eclipse.org/xsd/examples"
elementFormDefault="qualified">
...
...
</xs:schema>
        

  • xmlns:xsd="http://www.w3.org/2001/XMLSchema" - Indicates that the elements and data types used in the schema (schema, element, complexType, sequence, string, int, etc.) come from the "http://www.w3.org/2001/XMLSchema" namespace, which is also known as the schema for schemas. It also specifies that the elements and data types that come from the "http://www.w3.org/2001/XMLSchema" namespace should be prefixed with xsd in the example above.
  • xmlns="http://www.eclipse.org/xsd/examples" - Indicates that the default namespace is "http://www.eclipse.org/xsd/examples".
  • elementFormDefault="qualified" - Indicates that any elements used by the XML instance document that were declared in this schema must be namespace qualified.
The XML Schema model java interface for the root <schema> is org.eclipse.xsd.XSDSchema and can be created by calling org.eclipse.xsd.XSDFactory.eINSTANCE.createXSDSchema().


Main menuSection menuFeedbackNext
About IBM | Privacy | Legal | Contact