OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is this premitted ?



 > Dimiter Naydenov wrote:
 > > Thanks for the info about MSXML4 and schema support. Now I would like
to ask
> > something. I want to express the following model in a XML schema:
> >
> > 1. <tag attr="val">text</tag>
> > 2. <tag>
> >      <attr>complex val</attr>
> >      text
> >    </tag>
> >
> > If there is the attribute "attr" (1), the child element <attr>  must be
> > prohibited and vice versa (2).

If you add the following to your W3C XML Schema schema, then you can
validate
the constraint using the Topologi Schematron Validator, which supports this
kind of embedded schema.

Add to the XML Schemas element declaration
<annotation>
    <appinfo>
        <sch:pattern  xmlns:sch=http://www.ascc.net/xml/schematron" >
            <sch:rule context="tag">
                <sch:report test=self::*[@attr][attr]"
                > On a &lt;tag> element, if there is the attribute "attr",
                the child element &lt;attr>  must be prohibited and vice
versa.
               </sch:report>
        </sch:rule>
    </appinfo>
</annotation>

(The Validator can be downloaded free from http://www.topologi.com/  )

Cheers
Rick Jelliffe
Topologi