Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.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 元素不能有字符或元素信息项[子项],因为类型为';的内容类型为空_Xml_Xsd_Xml Validation - Fatal编程技术网

Xml 元素不能有字符或元素信息项[子项],因为类型为';的内容类型为空

Xml 元素不能有字符或元素信息项[子项],因为类型为';的内容类型为空,xml,xsd,xml-validation,Xml,Xsd,Xml Validation,当我在这个项目上工作时,我不断地得到一个错误,说: 元素“Customer”必须没有字符或元素信息项 [children],因为类型的内容类型为空 我不确定为什么这样做不起作用,因为我按照注释进行了操作,看起来是这样的: <xs:element name="Customer" type="xs:string"> <xs:complexType> <xs:attribute name="id" type="xs:integer" use="requ

当我在这个项目上工作时,我不断地得到一个错误,说:

元素“Customer”必须没有字符或元素信息项 [children],因为类型的内容类型为空

我不确定为什么这样做不起作用,因为我按照注释进行了操作,看起来是这样的:

<xs:element name="Customer" type="xs:string">  
  <xs:complexType>  
    <xs:attribute name="id" type="xs:integer" use="required"/>  
  </xs:complexType>  
</xs:element>


我知道这是说我不能把
type=“xs:string”
放在那里,但是我怎么才能让它有一个字符串呢?

你需要修正你的XSD对
Customer
的定义:在你的定义(Customer.XSD)中使用
xs:simpleContent
xs:complexType
而不是
xsl:element/@type


以上的XSD将考虑以下内容:

<Customer id="123">This is a string.</Customer>
这是一个字符串。
<Customer id="123">This is a string.</Customer>