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 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
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
 |
|
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 ASP Certificate is for developers who want to document their knowledge of ASP, SQL, and ADO.
|
|
|
Jump to: Top of Page
or HOME or
Printer friendly page
W3Schools provides material for training only. We do not warrant the correctness of its contents.
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-2008 by Refsnes Data. All Rights Reserved.
|
|
|