gpt4 book ai didi

xml - 如何在 XML 模式中声明只有属性的元素?

转载 作者:数据小太阳 更新时间:2023-10-29 01:44:20 24 4
gpt4 key购买 nike

给定:

<authentication password="turkey" partnerid="exam" />

如何在 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>

但是它会允许元素有文本内容,对吗?我不想那样...

最佳答案

您可以删除 xs:simpleContentxs: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>

关于xml - 如何在 XML 模式中声明只有属性的元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8809104/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com