鉴于:
<authentication password="turkey" partnerid="exam" />
Run Code Online (Sandbox Code Playgroud)
如何在XML模式中声明此元素?
我有:
<xs:element name="authentication" type="auth_type" />
<xs:complexType name ="auth_type">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="password" type="xs:string" />
<xs:attribute name="partnerid" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
Run Code Online (Sandbox Code Playgroud)
但它会让元素有文字内容,是吗?我不要那个...
Dan*_*ley 16
你可以删除xs:simpleContent和xs:extension....
<xs:element name="authentication" type="auth_type" />
<xs:complexType name ="auth_type">
<xs:attribute name="password" type="xs:string" />
<xs:attribute name="partnerid" type="xs:string" />
</xs:complexType>
Run Code Online (Sandbox Code Playgroud)