SimpleType和Attribute的XML Schema?

Nat*_*ate 16 xml xsd

我正在尝试创建一个XML模式,可以捕获看起来像这样的XML:

<tagname description="simple string type attribute">
false <!-- simple boolean type -->
</tagname>
Run Code Online (Sandbox Code Playgroud)

但我遇到了困难.甚至可以定义一个模式来捕获它,还是我在进行狙击

Ara*_*ram 38

干得好

<xs:element name="tagname">
        <xs:complexType>
            <xs:simpleContent>
                <xs:extension base="xs:boolean">
                    <xs:attribute name="description" type="xs:string" use="required"/>
                </xs:extension>
            </xs:simpleContent>
        </xs:complexType>
    </xs:element>
Run Code Online (Sandbox Code Playgroud)

这是经过验证的样本

<tagname xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="file:/C:/Untitled2.xsd" description="123">
    true
</tagname>
Run Code Online (Sandbox Code Playgroud)