我想定义一个带有受限文本和属性的元素。
这次出现的错误是(这次我没有添加任何限制;这只是为了测试):
对于类型“#AnonType_childparent”的复杂类型定义表示错误。当使用时,基本类型必须是复杂类型。“string”是一个简单类型。
我不太清楚这些错误到底意味着什么?是否有更好的错误文本解释可用?
<some_element my_attr="data">some restricted text</some_element>
How can I create an element like this?
I tried:
<complexType>
<simpleContent>
<restriction base="string">
<pattern value="AAA"></pattern>
<attribute name="newattr" type="string"></attribute>
</restriction>
</simpleContent>
</complexType>
但是却收到错误消息:
对于类型“#AnonType_childparent”的复杂类型定义表示错误。当使用<restriction>
时,基础类型必须是内容类型为简单的复杂类型,或仅在指定限制时,是具有混合内容和可为空粒子的复杂类型,或仅在指定扩展时,是简单类型。'string'不满足这些条件中的任何一个。
然后尝试了类似以下的内容
<complexType>
<complexContent>
<extension base="string">
<attribute name="attr" type="string"></attribute>
</extension>
</complexContent>
</complexType>
这次出现的错误是(这次我没有添加任何限制;这只是为了测试):
对于类型“#AnonType_childparent”的复杂类型定义表示错误。当使用时,基本类型必须是复杂类型。“string”是一个简单类型。
我不太清楚这些错误到底意味着什么?是否有更好的错误文本解释可用?