Venetian Blind Model : Venetian Blind « 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 » Venetian Blind 
3. 99. 1. Venetian Blind Model
The Venetian Blind Model encourages the use of complexTypes rather than just the declaration of elements. 
The idea behind types and the Venetian Blind Model is analogous to the notion of defining a class and using the class to create an object.

<?xml version = "1.0" ?>
<xs:schema xmlns:xs = "http://www.w3.org/2001/XMLSchema"
           targetNamespace = "http://www.java2java.com/Customers"
           xmlns = "http://www.java2java.com/Customers"
           elementFormDefault = "qualified"
           attributeFormDefault = "unqualified">
   
   <xs:element name = "Customer" type = "NameType" />
   
   <xs:complexType name = "NameType">
      <xs:sequence>
         <xs:element name = "FirstName" type = "xs:string" />
         <xs:element name = "MiddleName" type = "xs:string" 
                     minOccurs = "0" maxOccurs = "1" />
         <xs:element name = "LastName" type = "xs:string" />
      </xs:sequence>
      <xs:attribute name = "customerID" type = " xs:integer" 
                    use = "required" />
      <xs:attribute name = "clubCardMember" type = "xs:boolean" />
   </xs:complexType>
   
</xs:schema>


File: Data.xml

<?xml version = "1.0" ?>
<Customer xmlns = "http://www.java2java.com/Customers"
          xmlns:cust = "http://www.java2java.com/Customers"
          customerID = "2442"
          clubCardMember = "true" >
   <FirstName>first</FirstName>
   <MiddleName>middle</MiddleName>
   <LastName>last</LastName>
</Customer>
3. 99. Venetian Blind
3. 99. 1. Venetian Blind Model
www.java2java.com | Contact Us
Copyright 2010 - 2030 Java Source and Support. All rights reserved.
All other trademarks are property of their respective owners.