xml – 元素必须没有字符或元素信息项[children],因为类型的内容
发布时间:2020-12-15 23:56:26 所属栏目:百科 来源:网络整理
导读:当我在这个项目上工作时,我不断收到错误说: Element ‘Customer’ must have no character or element information item [children],because the type’s content type is empty. 我不确定为什么这不起作用看到我按照笔记看起来像这样: xs:element name="C
当我在这个项目上工作时,我不断收到错误说:
我不确定为什么这不起作用看到我按照笔记看起来像这样: <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:
<?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> 以上XSD将考虑以下内容: <Customer id="123">This is a string.</Customer> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |