Tuesday, March 31, 2015

super simple XSD example

<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
      xmlns:xs="http://www.w3.org/2001/XMLSchema">
   <xs:element name="Person">
      <xs:complexType>
         <xs:sequence>
            <xs:element name="Name" type="xs:string" minOccurs="1" />
            <xs:element name="Birthday" type="xs:dateTime" minOccurs="1" />
            <xs:element name="LikesCats" type="xs:boolean" minOccurs="1" />
            <xs:element name="NumberOfCats" type="xs:int" minOccurs="0" />
         </xs:sequence>
      </xs:complexType>
   </xs:element>
</xs:schema>

 
 

...should demand XML like of a shape like this:

<?xml version="1.0" encoding="utf-8" ?>
<Person>
   <Name>Carlos</Name>
   <Birthday>2009-06-15T13:45:30.0900000</Birthday>
   <LikesCats>true</LikesCats>
   <NumberOfCats>2</NumberOfCats>
</Person>

No comments:

Post a Comment