W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2012

Re: XML tests

From: Michael Kay <mike@saxonica.com>
Date: Tue, 28 Aug 2012 11:10:29 +0100
Message-ID: <503C9915.1020104@saxonica.com>
To: xmlschema-dev@w3.org

Looks like you need a content model which is

choice(
   sequence(newelement, element1),
   sequence(element1, element2, element3)
)

Michael Kay
Saxonica

On 28/08/2012 09:44, stuart shepherd wrote:
> I have a schema which validates my XML files very well, but I've 
> recently added a new optional element to a previous defined element, 
> and I would like to know if there is a way to test that if an element 
> is present then only certain other elements can be present.
>
> i.e
>
> old element, can have elements 1,2 and 3
>
> <toplevel>
>  <element1>...</element1>
>  <element2>...</element2>
>  <element3>...</element3>
> </toplevel>
>
> new element, if new element is present we can only have element 1.
>
> <toplevel>
>  <newelement/>
>  <element1>...</element1>
> </toplevel>
>
> Cheers
> Stuart
Received on Tuesday, 28 August 2012 10:10:34 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 28 August 2012 10:10:34 GMT