Create tables according to specific XML Schema (XSD) (1 Viewer)

shahiq

Registered User.
Local time
Today, 01:52
Joined
Mar 31, 2007
Messages
29
Brothers... Can anyone please tell me how I should create tables on MS SQL Database complying with the attached XSD. I have tried different ways but it doesnt seem to conform with the XSD. I think its something to do with how I set tables and its related fields.

Code:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
    <xs:appinfo> 
        MHEG EPG/PVR input data format. version 0_6
                
        Changes:
        Version 0_6
          - Removed unreferenced RecommendationsType type and recommendations element.
          - Removed unneccessary escape chars from date checking regex. 
        
        Version 0_5
            - A single mandatory Channel element per document.
            - Removed Listings level DefaultAuthority.
        
        Version 0_4
            - Synopsis is now optional for programmes, series and recommendations.
        
        
        Version 0_3
            - Made programme level CRID optonal to aid integration with exitsing (non-PVR) data sources.
               NOTE:  The programme level CRID must be defined when PVR functionality is required.
        
        Version 0_2
            - Added RecommendationsType to ProgrammeType
            - Added RecommendationType to RecommendationsType
            - Added SeriesType to ProgrammeType to allow a single series  to be defined per programme
            - RecommendationType and SeriesType define title, synopsis and single crid
            
        Version 0_1
              - Initial draft based on SimpleEPG.dtd with TVAnytime extentions.
    
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="listings" type="ListingsType">
    <xs:annotation>
      <xs:documentation>
                The root of the XML document
            </xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="ChannelType">
    <xs:sequence>
      <xs:element ref="programmes" />
    </xs:sequence>
    <xs:attribute ref="name" use="required" />
    <xs:attribute ref="name_abbreviated" use="optional" />
    <xs:attribute ref="default_authority" use="optional" />
  </xs:complexType>
  <xs:complexType name="ListingsType">
    <xs:sequence>
      <xs:element ref="channel" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="SeriesType">
    <xs:group ref="titleSynopsisCrid" />
  </xs:complexType>
  <xs:group name="titleSynopsisCrid">
    <xs:sequence>
      <xs:element ref="title" />
      <xs:element minOccurs="0" ref="synopsis" />
      <xs:element ref="crid" />
    </xs:sequence>
  </xs:group>
  <xs:complexType name="RecommendationType">
    <xs:group ref="titleSynopsisCrid" />
  </xs:complexType>
  <xs:complexType name="ProgrammeType">
    <xs:sequence>
      <xs:annotation>
        <xs:documentation>
                CRID element is optional only to aid integrattion with existing non-PVR data sources.
                CRID is mandatory at the programme level when for PVR functionality to work.
            </xs:documentation>
      </xs:annotation>
      <xs:element ref="title" />
      <xs:element minOccurs="0" ref="synopsis" />
      <xs:element minOccurs="0" ref="crid" />
      <xs:sequence minOccurs="0">
        <xs:element ref="series" />
      </xs:sequence>
      <xs:sequence minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="recommendation" />
      </xs:sequence>
    </xs:sequence>
    <xs:attribute ref="datetime_start" use="required" />
    <xs:attribute ref="datetime_end" use="required" />
    <xs:attribute ref="classification" use="optional" />
    <xs:attribute default="N" ref="captioned" use="optional" />
    <xs:attribute ref="descriptor1" use="optional" />
    <xs:attribute ref="descriptor2" use="optional" />
    <xs:attribute ref="descriptor3" use="optional" />
  </xs:complexType>
  <xs:complexType name="CridType">
    <xs:attribute ref="crid_type" use="required" />
    <xs:attribute ref="crid_value" use="required" />
  </xs:complexType>
  <xs:complexType name="ProgrammesType">
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
      <xs:element ref="programme" />
    </xs:sequence>
  </xs:complexType>
  <xs:attribute name="name" type="NameType" />
  <xs:attribute name="name_abbreviated" type="NameAbbreviatedType" />
  <xs:attribute name="datetime_start" type="DateTimeType" />
  <xs:attribute name="datetime_end" type="DateTimeType" />
  <xs:attribute name="classification" type="ClassificationType" />
  <xs:attribute default="N" name="captioned" type="CaptionedType" />
  <xs:attribute name="default_authority" type="AuthorityType" />
  <xs:attribute name="crid_type" type="CridTypeType" />
  <xs:attribute name="crid_value" type="CridValueType" />
  <xs:attribute name="descriptor1" type="DescriptorType" />
  <xs:attribute name="descriptor2" type="DescriptorType" />
  <xs:attribute name="descriptor3" type="DescriptorType" />
  <xs:simpleType name="CridValueType">
    <xs:annotation>
      <xs:documentation>
                The TVAnytime CRID.  Example:  crid://s-and-t.com/01DF5#one.
                May be shortenned to /01DF5#one is default_authority covers this entry.
            </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string" />
  </xs:simpleType>
  <xs:simpleType name="AuthorityType">
    <xs:annotation>
      <xs:documentation>
                The Default Authority in scope of the location of the default_authority.  Example default_authority:  crid://s-and-t.com.
            </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string" />
  </xs:simpleType>
  <xs:simpleType name="ClassificationType">
    <xs:annotation>
      <xs:documentation>
                characters in this field define the arbitrarality named graphic file also delivered with the data.   
                Example:  classification="15" describes a file named 15.png that is to be displayed by the EPG.
            </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string" />
  </xs:simpleType>
  <xs:simpleType name="DescriptorType">
    <xs:restriction base="xs:string" />
  </xs:simpleType>
  <xs:simpleType name="CaptionedType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Y" />
      <xs:enumeration value="N" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="NameType">
    <xs:annotation>
      <xs:documentation>
                The name of the channel as seen on TV.
            </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string" />
  </xs:simpleType>
  <xs:simpleType name="NameAbbreviatedType">
    <xs:annotation>
      <xs:documentation>
                Unix type identifier for the channel
            </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string" />
  </xs:simpleType>
  <xs:simpleType name="TitleType">
    <xs:annotation>
      <xs:documentation>
                The  title of the television programme.  The length must be defined by the design of the EPG so cannot be restricted here.
            </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string" />
  </xs:simpleType>
  <xs:simpleType name="SynopsisType">
    <xs:annotation>
      <xs:documentation>
                The  synopsis for the television programme.  The length must be defined by the design of the EPG so cannot be restricted here.
            </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string" />
  </xs:simpleType>
  <xs:simpleType name="DateTimeType">
    <xs:annotation>
      <xs:documentation>
                Format = dd/MM/yyyy HH:mm:ss
            </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:pattern value="\d{1,2}/\d{1,2}/\d{4}[ ]\d{2}:\d{2}:\d{2}" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="CridTypeType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="programme" />
      <xs:enumeration value="series" />
    </xs:restriction>
  </xs:simpleType>
  <xs:element name="channel" type="ChannelType">
    <xs:annotation>
      <xs:documentation>
                Once channel of programme data per XML document is recommended, though no restriction is made here.
            </xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:element name="recommendation" type="RecommendationType" />
  <xs:element name="programmes" type="ProgrammesType" />
  <xs:element name="series" type="SeriesType" />
  <xs:element name="programme" type="ProgrammeType">
    <xs:annotation>
      <xs:documentation>
                The list of programme schedule data must be contiguous in scope of the current EPG.
            </xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:element name="title" type="TitleType" />
  <xs:element name="crid" type="CridType" />
  <xs:element name="synopsis" type="SynopsisType" />
</xs:schema>
thanks
 

Users who are viewing this thread

Top Bottom