Viewpoint Developer Central    Viewpoint Forums    Viewpoint Forums  Hop To Forum Categories  Viewpoint XML Schema    Has this Schema been designed well?

Moderators: e_phoenix13
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Junior Member
Posted
Hi, self teaching myself xsd and my head is spinning with design patterns, I was looking for feedback as to if this document has been designed well or badly thanks in advance.

<?xml version="1.0" encoding="utf-8" ?><!--Created with Liquid XML Studio - FREE Community Edition 7.1.4.1284 (http://www.liquid-technologies.com)--><xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="SampleSchema"> <xs:annotation> <xs:documentation>A sample schema.</xs:documentation> </xs:annotation> <xs:complexType> <xs:sequence> <xs:element name="UserDetails" type="UserDetailsType" /> <xs:element name="SearchDetails"> <xs:annotation> <xs:documentation>Details about the travel method and type os fares.</xs:documentation> </xs:annotation> <xs:complexType> <xs:sequence> <xs:element name="MethodOfTravel" type="MethodOfTravelType" /> <xs:element name="Fares" type="FaresType" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="JourneyDetails" type="JourneyDetailsType" /> </xs:sequence> </xs:complexType> </xs:element> <xs:complexType name="UserDetailsType"> <xs:annotation> <xs:documentation>Client details.</xs:documentation> </xs:annotation> <xs:sequence> <xs:element name="CompanyId" type="CompanyIdType" /> <xs:element name="UserId" type="UserIdType" /> </xs:sequence> </xs:complexType> <xs:complexType name="CompanyIdType"> <xs:annotation> <xs:documentation>Two letter company identifier.</xs:documentation> </xs:annotation> <xs:attribute name="Id" type="TwoLetterCode" use="required" /> </xs:complexType> <xs:complexType name="UserIdType"> <xs:annotation> <xs:documentation>Six character (Alpha-Numeric) user identifier.</xs:documentation> </xs:annotation> <xs:attribute name="Id" type="SixLetterCode" use="required" /> </xs:complexType> <xs:complexType name="MethodOfTravelType"> <xs:annotation> <xs:documentation>Methods of travel available.</xs:documentation> </xs:annotation> <xs:sequence> <xs:element name="Bus" type="SearchAttribute" /> <xs:element name="Train" type="SearchAttribute" /> <xs:element name="Plane" type="SearchAttribute" /> <xs:element name="Boat" type="SearchAttribute" /> </xs:sequence> </xs:complexType> <xs:complexType name="SearchAttribute"> <xs:attribute name="Search" type="xs:boolean" use="required" /> </xs:complexType> <xs:complexType name="FaresType"> <xs:attribute name="View" type="FaresTypeAttribute" use="required" /> </xs:complexType> <xs:simpleType name="FaresTypeAttribute"> <xs:annotation> <xs:documentation>Which fares budget or all fares.</xs:documentation> </xs:annotation> <xs:restriction base="xs:string"> <xs:enumeration value="BUDGET" /> <xs:enumeration value="ALL" /> </xs:restriction> </xs:simpleType> <xs:complexType name="JourneyDetailsType"> <xs:annotation> <xs:documentation>Contains the journey details.</xs:documentation> </xs:annotation> <xs:sequence> <xs:element name="DeparturePoint" type="ThreeLetterCode" /> <xs:element name="DepartureDate" type="Date" /> <xs:element minOccurs="0" name="DepartureTime" type="Time" /> <xs:element name="ArrivalPoint" type="ThreeLetterCode" /> <xs:element minOccurs="0" name="ReturningDate" type="Date" /> <xs:element minOccurs="0" name="ReturningTime" type="Time" /> </xs:sequence> <xs:attributeGroup ref="JourneyDetailsAttributes" /> </xs:complexType> <xs:attributeGroup name="JourneyDetailsAttributes"> <xs:annotation> <xs:documentation>Attribute group for journey details.</xs:documentation> </xs:annotation> <xs:attribute name="DateFlexible" type="FlexibleAttribute" use="required" /> <xs:attribute name="TimeFlexible" type="FlexibleAttribute" use="required" /> </xs:attributeGroup> <xs:simpleType name="FlexibleAttribute"> <xs:restriction base="xs:string"> <xs:enumeration value="Y" /> <xs:enumeration value="N" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="TwoLetterCode"> <xs:annotation> <xs:documentation>Two character alpha code.</xs:documentation> </xs:annotation> <xs:restriction base="xs:string"> <xsRazzattern value="[A-Z]{2}" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="ThreeLetterCode"> <xs:annotation> <xs:documentation>Three character alpha code.</xs:documentation> </xs:annotation> <xs:restriction base="xs:string"> <xsRazzattern value="[A-Z]{3}" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="SixLetterCode"> <xs:annotation> <xs:documentation>Three character alpha-numeric code.</xs:documentation> </xs:annotation> <xs:restriction base="xs:string"> <xsRazzattern value="[A-Z0-9]{6}" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="Date"> <xs:annotation> <xs:documentation>Date in DDMMMYYYY format.</xs:documentation> </xs:annotation> <xs:restriction base="xs:string"> <xsRazzattern value="[0-9]{2}[A-Z]{3}[0-9]{4}" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="Time"> <xs:annotation> <xs:documentation>Time in HHMM format.</xs:documentation> </xs:annotation> <xs:restriction base="xs:int"> <xs:minInclusive value="0000" /> <xs:maxInclusive value="2359" /> </xs:restriction> </xs:simpleType></xs:schema>

Sorry about the formatting it loses its "pretty print" when I paste it, is there a way to format it without doing it by hand?
 
Posts: 3 | Registered: June 08, 2009Reply With QuoteEdit or Delete MessageReport This Post
  Powered by Eve Community  
 

Viewpoint Developer Central    Viewpoint Forums    Viewpoint Forums  Hop To Forum Categories  Viewpoint XML Schema    Has this Schema been designed well?