Element must have no character or element information item [children], because the type's content type is empty

前端 未结 1 2043
无人及你
无人及你 2021-01-18 21:53

As I work on this project I keep getting an error saying:

Element \'Customer\' must have no character or element information item [children], becaus

相关标签:
1条回答
  • 2021-01-18 22:08

    You'll need to fix your XSD's definition of Customer: Use xs:simpleContent with xs:complexType rather than xsl:element/@type in your definition (customer.xsd):

    <?xml version="1.0" encoding="utf-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
               version="1.0">
      <xs:element name="Customer">
        <xs:complexType>
          <xs:simpleContent>
            <xs:extension base="xs:string">
              <xs:attribute name="id" type="xs:integer" use="required"/>
            </xs:extension>
          </xs:simpleContent>
        </xs:complexType>
      </xs:element>
    </xs:schema>
    

    The above XSD will then consider content such as the following valid:

    <Customer id="123">This is a string.</Customer>
    
    0 讨论(0)
提交回复
热议问题