首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > XML SOAP >

xsd中怎么根据一个boolean属性来决定另一个属性

2012-02-07 
xsd中如何根据一个boolean属性来决定另一个属性?我想写个xsd,定义如下的xmlXML codeparent haschildtru

xsd中如何根据一个boolean属性来决定另一个属性?
我想写个xsd,定义如下的xml 

XML code
<parent haschild="true">   <child></child></parent> 


当haschild=true的时候,可以有child子节点,为false的时候不能有child子节点。
请问怎么写才能根据haschild的值来决定child节点的出现与否?

[解决办法]
设计问题,这样做是多余的。当parent 有 child 时,本身就代表了 hasChild = true,当 parent 不含 child 时,就代表了 hasChild = false。
xsd 是用来验证结构的,不是用来执行逻辑判断的。

热点排行