[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is this premitted ?
- From: Rick Jelliffe <ricko@allette.com.au>
- To: xml-dev@lists.xml.org
- Date: Mon, 02 Jul 2001 18:54:04 +0800
> 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 <tag> element, if there is the attribute "attr",
the child element <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