Lorenzo
Lorenzo

Reputation: 11

s4s-elt-invalid-content.1: The content of '#X' is invalid. Element 'element' is invalid, misplaced, or occurs too often

I have this problem:

s4s-elt-invalid-content.1: The content of '#AnonType_antipastimenu' is invalid. Element 'element' is invalid, misplaced, or occurs too often.

This is my XSD (XML Schema) code:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:element name="menu">
    <xs:complexType>
      <xs:all>
         <xs:element name="antipasti">
          <xs:complexType>
           <xs:element name="antipasto">
            <xs:element name="nome" type="xs:string" />
            <xs:element name="prezzo" type="xs:float" />
           </xs:element>
          </xs:complexType>
         </xs:element>
      </xs:all>
    </xs:complexType>
  </xs:element>
</xs:schema>

Upvotes: 1

Views: 535

Answers (1)

kjhughes
kjhughes

Reputation: 111660

xs:element cannot be the child of xs:complexType (first error) or another xs:element (second error).

Here is your XSD with the above corrections made so that it is at least valid wrt XSD grammar:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="menu">
    <xs:complexType>
      <xs:all>
        <xs:element name="antipasti">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="antipasto">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="nome" type="xs:string" />
                    <xs:element name="prezzo" type="xs:float" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:all>
    </xs:complexType>
  </xs:element>
</xs:schema>

Upvotes: 0

Related Questions