XML Schema to restrict one field based on another

こ雲淡風輕ζ 提交于 2019-12-05 18:03:07

It seems to me that this is a "has" relationship.

If you have a PhoneNumber element, then it should have a property that is of type PhoneNumberType. Rather than messing around with validating and restrictions, I would suggest that you turn PhoneNumber into a complex element and make PhoneNumberType a required property of it.

May be too late, but you can put them in group like this

<xs:group name="group">
<xs:sequence>
    <xs:element ref="PhoneNumber"/>
    <xs:element ref="PhoneNymberType" />
</xs:sequence>

And make this group required or not

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!