Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

XSD Problem!! (java)

Options
  • 08-12-2011 11:41am
    #1
    Registered Users 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