W3C home > Mailing lists > Public > www-forms@w3.org > January 2009

Clarification needed on cloning for insertion

From: John Boyer <boyerj@ca.ibm.com>
Date: Mon, 26 Jan 2009 17:27:59 -0800
To: public-forms@w3.org
Cc: "www-forms@w3.org" <www-forms@w3.org>, www-forms-editor@w3.org
Message-ID: <OF4BC67B11.428EE2F4-ON8825754B.00071B07-8825754B.00081144@ca.ibm.com>
In bullet 6 of the insert action [1], it states that the origin nodes are 
cloned.  Step 8 then describes inserting the cloned nodes into the XForms 
instances.

[1] 
http://www.w3.org/MarkUp/Forms/specs/XForms1.1/index-diff.html#action-insert

The specification assumes that the cloning/inserting will be done in a way 
that preserves the integrity of the cloned nodes with respect to XML 
namespaces.  This is based on the statement that XForms is backed by an 
XPath data model.  However, since many implementations use DOM machinery 
to implement, it is worth clarifying the difference between simple DOM 
cloning versus what is actually expected.

For example, suppose you have an origin node E in the following context: 
<prototypes xmlns="abc"> <E>hello</E> </prototypes>

Now suppose you insert it into live data as follows:  <livedata 
xmlns="xyz"> </livedata>

The question has arisen which of the two results is obtained:

A) <livedata xmlns="xyz"> <E>hello</E> </livedata>
B) <livedata xmlns="xyz"> <E xmlns="abc">hello</E> </livedata>

The answer should be choice B, since an element in the XPath data model is 
defined by its local name plus its namespace URI.

Further it is easier to see that this should be the case for consistency 
with the following example.

Suppose you have an origin node E in the following context:  <prototypes 
xmlns:e="abc"> <e:E>hello</e:E> </prototypes>

Now suppose you insert it into live data as follows:  <livedata 
xmlns="xyz"> </livedata>

A) <livedata xmlns="xyz"> <e:E>hello</e:E> </livedata>
B) <livedata xmlns="xyz"> <e:E xmlns:e="abc">hello</e:E> </livedata>

It is clear that answer B is correct since answer A, where there is an 
absence of proper namespace processing in the cloning process, results in 
an XML well-formedness violation.

John M. Boyer, Ph.D.
STSM, Interactive Documents and Web 2.0 Applications
Chair, W3C Forms Working Group
Workplace, Portal and Collaboration Software
IBM Victoria Software Lab
E-Mail: boyerj@ca.ibm.com 

Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer
Blog RSS feed: 
http://www.ibm.com/developerworks/blogs/rss/JohnBoyer?flavor=rssdw
Received on Tuesday, 27 January 2009 01:28:44 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:15 GMT