W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2006

specify element type depending of same element attribute value?

From: Crni Gorac <cgorac@gmail.com>
Date: Thu, 11 May 2006 18:00:16 +0200
Message-ID: <c02b565a0605110900g2116351bv3f500a05fa33fa35@mail.gmail.com>
To: xmlschema-dev@w3.org

Am trying to define schema for a not particularly complicated XML
input format.  However, I don't have much prior experience with XML
and schemas in particular, thus even simple stuff (and I guess is
simple because I know it would be trivial to define alike parts of
grammar if flat text format used instead of XML and lex/yacc employed
for parsing) looks complicated to me.  So I'd appreciate any kind of
help that this list could offer.  First problem is related to case
when type of contents of a simple element (not containing nested
element) is determined by this element attribute value.  Let's say
that we have a bag of apples and a bag of oranges and that we want to
select some apples and some oranges from these bags; and that it's
possible to select either all of items from given bag or items with
given indices or items with indices up to given index.  So some
combinations in corresponding XML file would be:
  <apples type="all"/>
  <oranges type="given"/>0 1 3 5 10</oranges>
or say:
  <apples type="upto"/>7</apples>
  <oranges type="given"/>1 2 3</oranges>
I know I need to use nonNegativeInteger for type of contents when
"upto" value of "type" attribute specified and then to use list of
nonNegativeInteger-s when when "max" value of "type" attribute; I know
also how to specify element with attribute only in XML schema for case
when "all" value of "type" attribute used.  But I'm not able to figure
out how to compose all of this into full specification of described
complex element type...

Received on Friday, 12 May 2006 20:33:16 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:10 UTC