Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.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在XSD中有效吗?_Xml_Xsd - Fatal编程技术网

Xml 空的complexType在XSD中有效吗?

Xml 空的complexType在XSD中有效吗?,xml,xsd,Xml,Xsd,我有一个XML模式,我需要处理,中间有一行: <xsd:complexType name="SomeName"/> 这是有效的XSD模式,还是一个complexType应该始终具有某种内容(子元素、属性、任何内容)?是的,它是有效的 有关模式,请参见 <xs:complexType name="complexType" abstract="true"> <xs:complexContent> <xs:extension base="xs

我有一个XML模式,我需要处理,中间有一行:

<xsd:complexType name="SomeName"/>

这是有效的XSD模式,还是一个
complexType
应该始终具有某种内容(子元素、属性、任何内容)?

是的,它是有效的

有关模式,请参见

 <xs:complexType name="complexType" abstract="true">
  <xs:complexContent>
   <xs:extension base="xs:annotated">
    <xs:group ref="xs:complexTypeModel"/>
    <xs:attribute name="name" type="xs:NCName"/>
    <xs:attribute name="mixed" type="xs:boolean" use="optional" default="false"/>
    <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
    <xs:attribute name="final" type="xs:derivationSet"/>
    <xs:attribute name="block" type="xs:derivationSet"/>
   </xs:extension>
  </xs:complexContent>
 </xs:complexType>

 <xs:group name="complexTypeModel">
  <xs:choice>
      <xs:element ref="xs:simpleContent"/>
      <xs:element ref="xs:complexContent"/>
      <xs:sequence>
       <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
       <xs:group ref="xs:attrDecls"/>
      </xs:sequence>
  </xs:choice>
 </xs:group>

 <xs:group name="attrDecls">
  <xs:sequence>
   <xs:choice minOccurs="0" maxOccurs="unbounded">
    <xs:element name="attribute" type="xs:attribute"/>
    <xs:element name="attributeGroup" type="xs:attributeGroupRef"/>
   </xs:choice>
   <xs:element ref="xs:anyAttribute" minOccurs="0"/>
  </xs:sequence>
 </xs:group>

因此,最低要求是:

<xs:complexType name="someNCName"/>


你的问题就是这样。

是的,这是一个完全有效的“空元素”。常用作“旗帜”。看一看。该示例包括一个带有属性的类型,但讨论是有效的


[编辑-新建URL]

XSD有效。。只是这个问题吗?@Xstian-或多或少,是的。我正在编写一个需要处理XSD的工具,而这个构造目前正在崩溃它。这在上下文中是毫无意义的,但我可以忽略它。根本的问题是——这个bug应该在XSD的源代码中修复(它是自动生成的,并且该软件中有许多其他bug),还是在我的处理器中修复。这个构造意味着在XML中可以是一个标签
,但里面没有字符。对于任何其他问题,请随意提问。对于“更接近”:它在哪方面是“主要基于意见的”,确切地说?这是一个非常具体和正确的技术问题。很公平。谢谢!:)嗯,只要我们还在做,
也有效吗?那是什么意思?是的。绝对有效。包含空内容的元素。语义可能非常不同。一种可能的用法类似于OOP中的“标记接口”。或者回想一下HTML

元素。但是即使是

元素也需要一个名称!这是。。。完全匿名。这在XML中会是什么样子?这是否意味着元素可以有它想要的任何名称?然后我没有正确理解您所说的
是什么意思。请用模式结构发布另一个问题。对不起,我不太清楚你在这里是什么意思。