Declaring an Element with a Simple Type : Simple Type « XML Schema « XML Tutorial

XML Tutorial
1. Introduction
2. Namespace
3. XML Schema
4. XPath
5. XSLT stylesheet
Java
XML
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
XML Tutorial » XML Schema » Simple Type 
3. 53. 1. Declaring an Element with a Simple Type
An element has a simple type if it's only allowed to contain other elements or attributes. 
There are many different built-in simple types.
You can create your own, based on one of the built-in types.

File: Schema.xsd

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

  <xs:element name="weight" type="xs:string" />

</xs:schema>


File: Data.xml 
<?xml version="1.0"?>
<weight>points</weight>

File: Schema.xsd

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

  <xs:element name="population" type="xs:integer" />
</xs:schema>


File: Data.xml

<?xml version="1.0"?>
<population>28</population>
3. 53. Simple Type
3. 53. 1. Declaring an Element with a Simple Type
3. 53. 2. Simple Type Definitions
3. 53. 3. XML Schemas provide a number of built-in simple types.
3. 53. 4. User-Defined Data types
3. 53. 5. The simple type may be defined globally, as a child of an attribute declaration, or within an element content model
3. 53. 6. A ISO date without a time zone
3. 53. 7. An anonymous simple string datatype for which any one of three literal string patterns (Small, Medium, or Large) are acceptable
www.java2java.com | Contact Us
Copyright 2010 - 2030 Java Source and Support. All rights reserved.
All other trademarks are property of their respective owners.