Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Aug 2006
    Location
    Gtr London, England
    Posts
    256
    Thanks
    2
    Thanked 0 Times in 0 Posts

    XML Schema - Matching Content

    Hi,

    Im trying to write a schema (which I am new at doing) and have a problem with setting an enumeration. The relevant code is detailed below and the section in question has been separated for ease of reference;

    <xsd:complexType name="MortgageClaimType">
    <xsd:sequence>
    <xsd:element name="CustomerUniqueIdentifier" type="xsd:string" />
    <xsd:element name="Claimant" type="ClaimantType" />
    <xsd:element name="Solicitor" type="SolicitorType" />
    <xsd:element name="Property" type="PropertyType" />
    <xsd:element name="Defendant" type="DefendantType" />
    <xsd:element name="ClaimantDesignation" type="xsd:string" />

    <xsd:simpleType>
    <xsd:restriction base="xs:string">
    <xsd:sequence>
    <xsd:enumeration value="LocalAuthority" />
    <xsd:enumeration value="Commercial" />
    </xsd:sequence>
    </xsd:restriction>
    </xsd:simpleType>

    <xsd:element name="ParticularsofClaim" type="xsd:string" />
    </xsd:sequence>
    </xsd:complexType>

    When validating Im getting the following message and am unsure as to what Im doing wrong;

    s4s-elt-must-match.1: The content of 'sequence' must match (annotation?, (element | group | choice | sequence | any)*). A problem was found starting at: simpleType. [28]

    Any suggestions would be grately appreciated.

    Cheers.
    Lee

  2. #2
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: XML Schema - Matching Content

    Hi Lee

    Sorry for the delay in getting back, this appears to have fallen off the edge of the desk, so I thought I would pick it up. From my uderstanding simple elements can only have the following data types:

    1) xs:string
    2) xs:decimal
    3) xs:integer
    4) xs:boolean
    5) xs:date
    6) xs:time

    The basic definitions will look like this:

    <xs:element name="Username" type="xs:string"/>
    <xs:element name="age" type="xs:integer"/>
    <xs:element name="signup" type="xs:date"/>

    You will have to review your <xsd:simpleType>

    I also suggest (and you have probably done this but the Lounge has removed the tabs) but try and indent your code to spot errors, "opening up code" in this fashion really spots the problems:

    <pre><xsd:complexType name="MortgageClaimType">
    <xsd:sequence>
    <xsd:element name="CustomerUniqueIdentifier" type="xsd:string" />
    <xsd:element name="Claimant" type="ClaimantType" />
    <xsd:element name="Solicitor" type="SolicitorType" />
    <xsd:element name="Property" type="PropertyType" />
    <xsd:element name="Defendant" type="DefendantType" />
    <xsd:element name="ClaimantDesignation" type="xsd:string" />
    </xsd:complexType></pre>


    and having said that, I couldn't work out why <xsd:element name="ParticularsofClaim" type="xsd:string" /> was sitting all by himself looking out of place? <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    Jerry

  3. #3
    3 Star Lounger
    Join Date
    Aug 2006
    Location
    Gtr London, England
    Posts
    256
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Re: XML Schema - Matching Content

    Hi Jerry,

    Thanks for that, I'll review the script with your comments in mind and see if I can get the enumeration to work.

    Cheers.
    Lee

  4. #4
    3 Star Lounger
    Join Date
    Aug 2006
    Location
    Gtr London, England
    Posts
    256
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Re: XML Schema - Matching Content

    Hi Jerry,

    Ive fixed the problem !! As with everything its always the most obvious. You will note that the 'xsd:restriction type base = "xs:string" ' - It should have been "xsd:string" !! So it was just basically a typo !

    Thanks for your help.

    Cheers.
    Lee

  5. #5
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: XML Schema - Matching Content

    <img src=/S/nuts.gif border=0 alt=nuts width=15 height=15> Well spotted
    Jerry

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •