Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

XSD Problem!! (java)

  • 08-12-2011 11:41AM
    #1
    Registered Users, Registered Users 2 Posts: 1,712 ✭✭✭


    I am validating an xml file against an xsd and am getting an error and i dont know why, was wondering if anyone ever seen it.

    This is the xml
    <parameterCode>
        <mode/>
        <labels>
          <label lang="DE">REP_PBW</label>
          <label lang="EN">REP_PBW</label>
          <label lang="ES">REP_PBW</label>
          <label lang="FF">REP_PBW</label>
          <label lang="FR">REP_PBW</label>
          <label lang="NL">REP_PBW</label>
        </labels>
        <rtp_cod_ext>REP_PBW</rtp_cod_ext>
      </parameterCode>
    

    and this is the part of the xsd for the parameter code element
    <xs:complexType name="ParameterCode">
          <xs:all>
             <xs:element name="mode" type="xs:string" minOccurs="0">
                <xs:annotation>
                   <xs:documentation>mode: addition or modification. Simply specify A or M as a value</xs:documentation>
                </xs:annotation>
             </xs:element>
             <xs:element name="labels" type="Labels"/>
             <xs:element name="tdo_cod_ext" type="xs:string">
                <xs:annotation>
                   <xs:documentation>External code</xs:documentation>
                </xs:annotation>
             </xs:element>
          </xs:all>
       </xs:complexType>
    


    My problem is i get an error on validating the xml against the xsd. Its complaining about the mode. The mode element doesnt contain a value, this case so i think this is why. this is my error:
    <errors>
    <error column="20" line="14" systemID="file:///C:/Documents and Settings/cmo/Desktop/dir/RTP.xml">The content of element type "parameterCode" is incomplete, it must match "all(mode?,labels,rtp_cod_ext,list_rtp_lan_str_nom)".</error>
    <error column="20" line="26" systemID="file:///C:/Documents and Settings/cmo/Desktop/dir/RTP.xml">The content of element type "parameterCode" is incomplete, it must match "all(mode?,labels,rtp_cod_ext,list_rtp_lan_str_nom)".</error>
    </errors>Property: mode ,Value:
    


    Would anyone have an idea as to why this is failing on me? I tried putting nillible="true" into the xsd element to allow empty strings but it doesnt appear to have worked.


    Thanks in advance.

    Neil


Comments

Advertisement