W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2002

Element definition without a predefined element name?

From: Rune Bjørnstad <r.p.bjornstad@student.utwente.nl>
Date: Sat, 9 Nov 2002 00:24:29 +0100
To: <xmlschema-dev@w3.org>
Message-ID: <000001c2877d$ffae7400$e4e75982@oppe>
I’ve been reading through the specs. And I can’t seem to find the answer
to my problem. I want to define a schema that validates an XML document
containing the following construct:
 
<someelement attr1=”value”>
          <child1>
                   <class>some.class.Test1</class>
                   <process>process_description</process>
          </child1>
          <child2>
                   <class>some.class.Test1</class>
                   <process>process_description</process>
          </child>
</someelement>
 
Looks trivial, but here’s the catch. I don’t want to define the names
child1, child2 etc. in the schema, but I need them to be of a certain
complexType. In short: How do I define <someelement> to contain a
sequence of children, with arbitrary names, but of a fixed complexType?
I know that I can get close by allowing the following:
 
<someelement attr1=”value”>
          <child name=”child1”>
                   <class>some.class.Test1</class>
                   <process>process_description</process>
          </child>
          <child name=”child2”>
                   <class>some.class.Test1</class>
                   <process>process_description</process>
          </child>
</someelement>
 
But this does not fit the requirements of my project.
 
Kind Regards,
 
Rune Bjørnstad.
 <mailto:r.p.bjornstad@student.utwente.nl>
r.p.bjornstad@student.utwente.nl
 
 
Received on Saturday, 9 November 2002 03:43:38 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:35 GMT