15-Jun-17 (Created: 15-Jun-17) | More in 'Old Jaxb 2.0 Tutorial 2014'

jaxb 2.0 tutorial: XSD File

Manage this page

1. Back to tutorial

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
   elementFormDefault="qualified" 
   attributeFormDefault="unqualified">
<!--
*********************************************
* Root node
*********************************************
-->
   <xs:element name="content" type="ContentType">
   </xs:element>
<!--
*********************************************
* FileType
*********************************************
-->
   <xs:complexType name="FileType">
      <xs:all>
         <xs:element name="description" type="xs:string"/>
         <xs:element name="content" type="xs:string"/>
      </xs:all>
      <xs:attribute name="id" type="xs:integer"/>
      <xs:attribute name="name" type="xs:string"/>
   </xs:complexType>
   <!--
*********************************************
* FolderType
*********************************************
-->
   <xs:complexType name="FolderType">
      <xs:sequence>
         <xs:element name="file" type="FileType" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
      <xs:attribute name="id" type="xs:integer"/>
      <xs:attribute name="name" type="xs:string"/>
   </xs:complexType>
   <!--
*********************************************
* ContentType
*********************************************
-->
   <xs:complexType name="ContentType">
      <xs:sequence>
         <xs:element name="file" type="FileType" minOccurs="0" maxOccurs="unbounded"/>
         <xs:element name="folder" type="FolderType" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
   </xs:complexType>
</xs:schema>