小编Dav*_*ave的帖子

为直接定义的属性或引用选择XML实例上的属性

我正在寻找一种为元素选择属性的变体,可以直接设置或引用.

这就是我的想法:

<root>    
<element>
   <attribute ref="shortname" />
</element>
<element>
   <attribute name="shortname" isEditable="true" anotherattrib="0815" />
</element>
</root>
Run Code Online (Sandbox Code Playgroud)

由于没有xml方案这不会有问题,如果需要元素属性的属性"name",则此属性的定义非常困难.

该计划可能看起来像这样

<xs:element name="attribute">
<xs:complexType>
<xs:attribute name="ref" use="required" />
<xs:attribute name="name" use="required" />
</xs:complexType>
</xs:element>
Run Code Online (Sandbox Code Playgroud)

是否有可能在属性之间做出选择(类似于xs:元素的选择)?就像从名为ref的元素属性中存在属性一样,不允许其他属性.如果没有,必须设置属性"名称"...

这个问题听起来很纯粹的虚拟和学术,但如果有可能有解决方案,或者我对我的想法完全错误,我会很高兴:)

预先感谢您的任何帮助!

戴夫

xml xsd

6
推荐指数
1
解决办法
6536
查看次数

标签 统计

xml ×1

xsd ×1