W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2003

Help! Can't XML Schema do this?

From: Norris Merritt <norris.merritt@peregrine.com>
Date: Mon, 24 Feb 2003 15:30:53 -0800
Message-ID: <D54BF26DB5A7D511B36B00508B9596A40371FBBB@sdgcaexch2.peregrine.com>
To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>

I'm having trouble trying to create one small set of reusable .xsd
definitions that I can use to describe a lot of existing xml fragments that
follow the simple pattern shown below, without having to hard-code any
element names.  If I have to define a complex type for each such XML
fragment, and hard-code the element names for the contained child elements,
it forces me to replicate the same schema definitions many many times, even
though all the XML fragments have the exact same structure and follow the
same rules. They just have different element names. For example:

<Array1 mytype="array">
  <Array1Elem mytype="string">foo</Array1Elem>
  <Array1Elem mytype="string">bar</Array1Elem>

I have many occurrences of XML fragments like the one shown above. It is
infeasible to duplicate the schema code for each possible element name.  So
I just want to define some complex types where the actual element names can
vary.  All of the contained elements always have the same name and type.

Can this be done using abstract elements? Substitution groups? Some other
feature? Not at all?
Received on Monday, 24 February 2003 19:02:45 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:59 UTC