XML schema Element

|  | Search W3Schools : |

HOME | HTML | CSS | XML | JAVASCRIPT | ASP | PHP | SQL | MORE... |  | References | Examples | Forum | About

ADVERTISEMENTS XML Certification Download XML editor Custom Programming |  |

Table of contents

Schema Tutorial
XSD HOME
XSD Intro
XSD Why Use
XSD How To
XSD <schema>
Simple Types
XSD Elements
XSD Attributes
XSD Restrictions
Complex Types
XSD Elements
XSD Empty
XSD Elements Only
XSD Text Only
XSD Mixed
XSD Indicators
XSD <any>
XSD <anyAttribute>
XSD Substitution
XSD Example
Data Types
XSD String
XSD Date
XSD Numeric
XSD Misc
XSD Editor
XSD Summary
References
XSD Reference
XSD Validator

Selected Reading

Web Statistics
Web Glossary
Web Hosting
Web Quality
W3Schools Tutorials
W3Schools Forum
Helping W3Schools

# XML schema Element

Complete XML Schema Reference

## Definition and Usage

The schema element defines the root element of a schema.

### Element Information

- Parent elements: NONE

### Syntax

    <schema
    id=ID
    attributeFormDefault=qualified|unqualified
    elementFormDefault=qualified|unqualified
    blockDefault=(#all|list of (extension|restriction|substitution))
    finalDefault=(#all|list of (extension|restriction|list|union))
    targetNamespace=anyURI
    version=token
    xmlns=anyURI
    any attributes
    >

    ((include|import|redefine|annotation)*,(((simpleType|complexType|
    group|attributeGroup)|element|attribute|notation),annotation*)*)

    </schema>

Attribute | Description
--- | ---
id | Optional. Specifies a unique ID for the element
attributeFormDefault | Optional. The form for attributes declared in the target namespace of this schema. The value must be "qualified" or "unqualified". Default is "unqualified". "unqualified" indicates that attributes from the target namespace are not required to be qualified with the namespace prefix. "qualified" indicates that attributes from the target namespace must be qualified with the namespace prefix
elementFormDefault | Optional. The form for elements declared in the target namespace of this schema. The value must be "qualified" or "unqualified". Default is "unqualified". "unqualified" indicates that elements from the target namespace are not required to be qualified with the namespace prefix. "qualified" indicates that elements from the target namespace must be qualified with the namespace prefix

blockDefault

Optional. Specifies the default value of the block attribute on element and complexType elements in the target namespace. The block attribute prevents a complex type (or element) that has a specified type of derivation from being used in place of this complex type. This value can contain #all or a list that is a subset of extension, restriction, or substitution:

- extension - prevents complex types derived by extension
- restriction - prevents complex types derived by restriction
- substitution - prevents substitution of elements
- #all - prevents all derived complex types

finalDefault

Optional. Specifies the default value of the final attribute on element, simpleType, and complexType elements in the target namespace. The final attribute prevents a specified type of derivation of an element, simpleType, or complexType element. For element and complexType elements, this value can contain #all or a list that is a subset of extension or restriction. For simpleType elements, this value can additionally contain list and union:

- extension - prevents derivation by extension
- restriction - prevents derivation by restriction
- list - prevents derivation by list
- union - prevents derivation by union
- #all - prevents all derivation

targetNamespace | Optional. A URI reference of the namespace of this schema
version | Optional. Specifies the version of the schema
xmlns | A URI reference that specifies one or more namespaces for use in this schema. If no prefix is assigned, the schema components of the namespace can be used with unqualified references
any attributes | Optional. Specifies any other attributes with non-schema namespace

### Example 1

    <?xml version="1.0"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:element name="values" type="xs:string">

    </xs:schema>

### Example 2

In this example, the schema components (element name, type) in the http://www.w3.org/2001/XMLSchema namespace are unqualified and those for http://www.w3schools.com/w3schoolsschema (mystring) are qualified with the wsc prefix:

    <?xml version="1.0"?>
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
    xmlns:wsc="http://www.w3schools.com/w3shoolsschema">

    <element name="fname" type="wsc:mystring"/>

    </schema>

Complete XML Schema Reference

## Altova® MissionKit® - Integrated suite of XML tools

The Altova MissionKit is a suite of intelligent XML tools, including:

XMLSpy® – industry-leading XML editor

- Support for all XML-based technologies
- Graphical editing views, powerful debuggers, code generation, & more

MapForce® – graphical data mapping tool

- Drag-and-drop data conversion with code generation
- Support for XML, DBs, EDI, Excel® 2007, text, Web services

StyleVision® – visual stylesheet designer

- Drag-and-drop stylesheet design for XML & databases
- Output to HTML, PDF, RTF, Word 2007, & more

And more…

Try before you buy with a free fully functional 30-day trial

Download today

## Get Your Diploma!

W3Schools' Online Certification Program is the perfect solution for busy professionals who need to balance work, family, and career building.

The HTML Certificate is for developers who want to document their knowledge of HTML, XHTML, and CSS.

The JavaScript Certificate is for developers who want to document their knowledge of JavaScript and the HTML DOM.

The XML Certificate is for developers who want to document their knowledge of XML, XML DOM and XSLT.

The ASP Certificate is for developers who want to document their knowledge of ASP, SQL, and ADO.

The PHP Certificate is for developers who want to document their knowledge of PHP and SQL (MySQL).

WEB HOSTING
ASP.NET Web Hosting
$15 Domain Name Registration Save $20 / year!
Buy UK Domain Names Register Domain Names
Cheap Domain Names Cheap Web Hosting
Best Web Hosting
PHP MySQL Hosting
Top 10 Web Hosting
UK Reseller Hosting
Web Hosting
FREE Web Hosting

WEB BUILDING
Website Templates Flash Templates Website Builder Internet Business Opportunity
Custom Programming
FREE Trial or Demo Web Content Manager Forms,Web Alerts,RSS
Download XML editor
FREE Flash Website
FREE Web Templates

EDUCATION
US Web Design Schools
HTML Certification
JavaScript Certification
XML Certification
PHP Certification
ASP Certification

HOME or Top of Page |  | Printer Friendly
W3Schools is for training only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy. Copyright 1999-2009 by Refsnes Data. All Rights Reserved.