"element" - The Element Declaration Statement

This section describes syntax formats of the 'element' statement, which declares an XML element in the target namespace. If an element of the same name used in the target namespace, it must match the specified element type.

element is an XSD statement that declares an XML element in the target namespace.

Valid syntax formats for the "element" statement are:

<xsd:element name="target-element-name"/>

<xsd:element name="target-element-name" type="type-name"/>

<xsd:element name="target-element-name">
  ... type declaration statement ...
</xsd:element>

General rules about the "element" statement:

Examples of "element" statements:

<!-- Using an XML Schema built-in element type -->
<xsd:element name="holiday" type="xsd:date"/>

<!-- Using an inline element type -->
<xsd:element name="numbers">
 <xsd:simpleType>
  <xsd:list itemType="xsd:decimal"/>
 </xsd:simpleType>
</xsd:element>

<!-- Using an element type declared separately -->
<xsd:element name="phone" type="phoneType"/>
<xsd:simpleType name="phoneType">
 <xsd:restriction base="xsd:string">
  <xsd:pattern value="\d\d\d-\d\d\d\d"/>
 </xsd:restriction>
</xsd:simpleType>

Table of Contents

 About This Book

 Introduction of XML (eXtensible Markup Language)

 XML File Syntax

 XML File Browsers

 XML-JSON Document Conversion

 DOM (Document Object Model) Programming Interface

 SAX (Simple API for XML) Programming Interface

 DTD (Document Type Definition) Introduction

 Syntaxes of DTD Statements

 Validating an XML Document against the Specified DTD Document Type

 XSD (XML Schema Definition) Introduction

Syntaxes of XSD Statements

 "schema" - The Schema Declaration Statement

"element" - The Element Declaration Statement

 Simple Element Types with Built-in Data Types

 Simple Element Types with Extended Data Types

 Complex Element Types

 Simple Content Element Types

 Empty Element Types

 Anonymous or Inline Data Types

 dictionary.xsd - A Sample XSD XML Schema File

 Validating XML Documents Against Specified XML Schemas

 XSL (Extensible Stylesheet Language) Introduction

 Java Implementation of XSLT

 XSLT (XSL Transformations) Introduction

 XPath (XML Path) Language

 XSLT Elements as Programming Statements

 Control and Generate XML Element in the Result

 PHP Extensions for XML Manipulation

 Processing XML with Python Scripts

 XML Notepad - XML Editor

 XML Tools Plugin for Notepad++

 XML Plugin Packages for Atom Editor

 XML 1.1 Changes and Parsing Examples

 Archived Tutorials

 References

 Full Version in PDF/EPUB