RE: [XForms] ID/IDREF relationships in XML instances

Greetings Mark, I have seen the scenario you describe once before.

Copying values from one part of an instance to another can be achieved 
using <setvalue>.

The complication in what you are trying to do is the use of attributes of 
type id within a repeat. Because of the uniqueness requirement we do not 
copy ids when we insert an element into a repeat.

However, should your application be able to define the maximum number of 
<person>s and <address)es you could predefine a set of empty ones but with 
predefined ids (which I'm assuming you do not show the user).

Then, for example, when a user selects "the second address they supplied" 
as the abode for "this person" a <setvalue> could be used in an event 
handler to copy the appropriate id value.

Regards, Roland




"Mark Seaborne" <MSeaborne@origoservices.com>
Sent by: www-forms-request@w3.org
18/11/2002 15:59

 
        To:     <AndrewWatt2001@aol.com>
        cc:     <XForms@yahoogroups.com>, <www-forms@w3.org>
        Subject:        RE: [XForms] ID/IDREF relationships in XML instances

 



Andrew

Thanks for clearing that up then :)

All I want to do is to have a form that understands and maintains the 
relationship between the address and person in the XML below:

<my_xml>
<address id="a">
<line_1>4 Heronimous Road</line_1>
<line_2>Skegness</line_2>
<line_3/>
<line_4/>
<postcode>SK1 1KS</postcode>
</address>
<person id="i">
<forenames>Harold</forenames>
<surname>Biggs</surname>
<address address_id="a"/>
</person>
</my_xml>

where both person and address repeat, one person may have only one 
address, but one address can be linked to none or more persons. Maybe I 
should be expressing something like this in the schema, or in the model? 
Thinking about it, perhaps keys would do the trick?

Any other advice, or experience would certainly be welcomed.


All the best

Mark

Received on Tuesday, 19 November 2002 08:33:00 UTC