arrays

There is a bit of ambiguity in the WD about how to represent arrays in a
form, and handle multiple occurences of the same form path (the name
attribute).  The problem lies in the form element naming syntax, which
specifies a path to an element (such as "purchaseOrder.shipTo.name") but
does not specify which index into an array that it points to.

For example, for this xform:

<model>
  <group name="contacts">
    <group name="person" maxoccurs="*">
      <string name="name" maxoccurs="*"/>
    </group>
  </group>
</model>


Say we had an XHTML form like this:

Person 1:
<input type="text" name="contacts.person.name"/><br/>
Person 2:
<input type="text" name="contacts.person.name"/><br/>
Person 3:
<input type="text" name="contacts.person.name"/><br/>

When generating an instance, how does the processor know where to put person
and name elements?  Due to this lack of specificity, the XForm could have
one of these possible resulting instances:

<contacts>
	<person><name>Bob</name></person>
	<person><name>Ed</name></person>
	<person><name>Ray</name></person>
</contacts>

... OR

<contacts>
	<person><name>Bob</name><name>Ed</name><name>Ray</name></person>
</contacts>


As you can see, the simple path "contacts.person.name" doesn't say when to
create a new element at each level of the path.  Would it make sense to give
more power to the path language than just separating levels by periods?
Could we add another operator such as "+" which indicates to create a new
element?

So, for example, "contacts+person.name" would state that a new person
element should always be created, while "contacts.person.name" would state
that the last created person element (within contacts) should be used, and
one should be created if none exists.

Does this make any sense?

- Joe

Received on Wednesday, 19 April 2000 20:41:29 UTC