XML架构:属性仅包含文本的元素?

我很难找到这个。如何在XML模式文件中为XML定义如下所示的元素:

<选项值=“测试”>sometext&lt/选项>

我不知道如何定义类型为xs:string且具有属性的元素

以下是到目前为止我得到的信息:

<xs:element name=“option”>
<xs:complexType>
<xs:attribute name=“value”type=“xs:string”/>
&lt/xs:complexType>
&lt/xs:element>

试一试

<xs:element name=“option”type=“attrement”/>
<xs:complexType name=“attriment”>
<xs:simpleContent>
<xs:extension base=“xs:string”>
<xs:attribute name=“value”type=“xs:string”>
&lt/xs:attribute>
&lt/扩展>
&lt/xs:simpleContent>
&lt/xs:complexType>

发表评论