[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xsd- abstract definition

Subject: Re: xsd- abstract definition
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Wed, 2 Oct 2002 14:18:33 +0100
xsd abstract attribute
Hi Laura,

> forgive me this is a bit off topic.

It is really -- you should send queries about W3C XML Schema to

> 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:element ref="_item" minOccurs="0" maxOccurs="unbounded" />

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" />

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



Jeni Tennison

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.