This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: xsd- abstract definition
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: "Laura Jenkins" <xsl_list at hotmail dot com>
- Cc: xsl-list at lists dot mulberrytech dot com
- Date: Wed, 2 Oct 2002 14:18:33 +0100
- Subject: Re: [xsl] xsd- abstract definition
- Organization: Jeni Tennison Consulting Ltd
- References: <F1404EFkQH5f1d1BZ9c0000699e@hotmail.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi Laura,
> forgive me this is a bit off topic.
It is really -- you should send queries about W3C XML Schema to
xmlschema-dev@w3.org.
> I have an xsd file, with one of the elements with an attribute
> abstract = "true". and i used XML spy to generate an xml file out of
> it. and the generated xml can not be validated w.r.t. it says that
> the problem is with the abstract value being set to true. However i
> changed the value of abstract to false and it is perfectly a valid
> file .. I have no clue of the XSD file because it is passed on to me
> by one of our clients. Can anyone explain me what "abstract=true"
> means?
It means that the element itself can't actually appear in the
document. For example, if you had:
<xs:element name="_inline" abstract="true" />
then a document couldn't actually have a <_inline> element in it.
So what's the point? Well, in W3C XML Schema you can provide element
substitution groups which basically say that wherever a particular
element is specified within a content model, a whole bunch of other
elements can appear in their place. For example, you could do:
<xs:element name="emph" substitutionGroup="_inline" />
<xs:element name="strong" substitutionGroup="_inline" />
<xs:element name="code" substitutionGroup="_inline" />
<xs:element name="span" substitutionGroup="_inline" />
...
and it means that when you had a content model like:
<xs:sequence>
<xs:element ref="_item" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
it would be interpreted as being exactly the same as:
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="emph" />
<xs:element ref="strong" />
<xs:element ref="code" />
<xs:element ref="span" />
...
</xs:choice>
It also has a kind of conceptual advantage in that it says "these
elements are all inline elements".
Usually when you create substitution groups, you don't want the "head
element" (like _inline in this example) to actually be allowed in a
document. Making it abstract forces one of the members of the
substitution group to be used in its place.
I hope that explains things a bit; do post follow-ups to
xmlschema-dev@w3.org.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list