开发者

How can we define an XML schema which restricts the value of one element in a sequence of elements of same type?

开发者 https://www.devze.com 2023-03-04 12:34 出处:网络
I have an xml which is something like 开发者_如何学编程this: <parent> <child> <value>Fixed value</value>

I have an xml which is something like 开发者_如何学编程this:

<parent>
    <child>
        <value>Fixed value</value>
    </child>
    <child>
        <value>Any value</value>
    </child>
    <child>
        <value>Any value</value>
    </child>
    More children 
</parent>

How do I define a schema to check this? i.e. constrain some elements in a sequence of elements to have a child element of a given value. I currently get a warning that the schema is ambiguous.


This is not possible since - as the warning states - it makes the definition of the element ambiguous.

Xml schema doesn't evaluate or validate the content or order of your Xml data, only the structure and data types.

0

精彩评论

暂无评论...
验证码 换一张
取 消