RaceBase
RaceBase

Reputation: 18848

s4s-elt-invalid-content.1 in XML Validation

I am newbie to XML.

I am validating one XML/XSD file. But Eclipse is throwing below validation error

s4s-elt-invalid-content.1

Here's the code where it's having issues in XSD.

<complexType name="Check_String">
    <complexContent >
        <extension base="tns:Boolean"/>
    </complexContent>
    <complexContent >
        <extension base="tns:String"/>
    </complexContent>
</complexType>

I am not sure how to solve this. Can any one explain why this error and workaround. because of this validation of XML fails

 <attribute name="Reset password Call Barring"  xsi:type="tns:Check_String"  nillable="true" vdsl2Name="PSWD">
            <conditions when="BADPAYER_DisableAllForPSTN" enabled="false"/>
 </attribute>

Upvotes: 0

Views: 1134

Answers (1)

Petru Gardea
Petru Gardea

Reputation: 21638

The content model of a complex type must consist of 'annotation' (if present); followed by zero or one of the following: 'simpleContent', 'complexContent', 'group', 'choice', 'sequence', or 'all'; followed by zero or more 'attribute' or 'attributeGroup'; followed by zero or one 'anyAttribute'.

Here you're showing two complexContent.

I assume that in your case, the default namespace is http://www.w3.org/2001/XMLSchema

It is hard to say what you're trying to achieve; if these would be simple types, then maybe a union might help you instead, if you were trying to go after allowing both types...

UPDATE: this is an example of a union:

<?xml version="1.0" encoding="utf-8" ?>
<!--XML Schema generated by QTAssistant/XML Schema Refactoring (XSR) Module (http://www.paschidev.com)-->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:simpleType name="Boolean">
        <xsd:restriction base="xsd:boolean"/>
    </xsd:simpleType>
    <xsd:simpleType name="String">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="some"/>
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="Check_String">
        <xsd:union memberTypes="Boolean String"/>
    </xsd:simpleType>
    <xsd:element name="root" type="Check_String"/>
</xsd:schema>

Upvotes: 2

Related Questions