Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml 为什么<;complexType>;具有基本元素内容的元素是否需要标记?_Xml_Xsd - Fatal编程技术网

Xml 为什么<;complexType>;具有基本元素内容的元素是否需要标记?

Xml 为什么<;complexType>;具有基本元素内容的元素是否需要标记?,xml,xsd,Xml,Xsd,我必须按如下方式编写我的xsd代码段 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="foos"> <xs:complexType> <xs:sequence> <xs:element type="fo

我必须按如下方式编写我的xsd代码段

<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>

为什么我不能像下面这样写,它会简单得多

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <xs:element name="foos">
        <xs:element type="foo" name="foo"/>
    </xs:element>
</xs:schema>

如果元素包含其他元素、空元素、包含文本的元素或子元素,则它们属于复杂类型。当您想要编写模式时,必须遵循XSD规则

如果元素包含其他元素、空元素、包含文本的元素或子元素,则它们属于复杂类型。当您想要编写模式时,必须遵循XSD规则