开发者

Why is the <complexType> tag required for elements with basic element content?

I have to write my xsd snippet as below.

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

    <xs:element name="foos">
        <xs:complexType>
            <xs:sequence>
                <xs:element type="foo" name="foo"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

Why can't I write it like as shown below, it will be much simpler?

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSche开发者_如何转开发ma" elementFormDefault="qualified">
    <xs:element name="foos">
        <xs:element type="foo" name="foo"/>
    </xs:element>
</xs:schema>


If an element contains others elements, empty elements, elements with text or child elements they fall under the category of complex type. It's the XSD rules that have to followed when you want to write a schema!!!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜