This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: xsd- abstract definition


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]