W3C home > Mailing lists > Public > www-forms@w3.org > November 2008

RE: Problems with xf:copy and xf:delete...

From: Philip Fennell <Philip.Fennell@bbc.co.uk>
Date: Thu, 20 Nov 2008 09:29:28 -0000
Message-ID: <FBFAE0E0B37B4148AF77509764D4BC2007B1E75A@bbcxues11.national.core.bbc.co.uk>
To: <dev-tech-xforms@lists.mozilla.org>
Cc: <www-forms@w3.org>

Aaron,

The reason I believe that there is a problem is that in section 9.3.7
The copy Element, the spec says:

The element node associated with the item, selected by the binding
attributes on copy, is deep copied as a child of the target node as if
an insert action had occurred.

It is possible to argue that because the observed behaviour is not
explicitly ruled-out in the definition of xf:copy I don't believe either
that it is possible to argue that the observed behaviour is acceptable.

I guess this would never have been an issue if the atom:category element
was the child of a atom:categories element.

Due to the lack of detail in the spec I'm gowing to throw this over to
the www-forms@w3.org list to see if anyone else has an opinion either
way on the subject.


Regards

Philip Fennell
>XML Developer (The Forge)
>
>BBC Future Media & Technology
>Media Village, 201 Wood Lane London W12 7TP 
>BC4 C4, Broadcast Centre
>
>T:	0208 0085318
>

-----Original Message-----
From: dev-tech-xforms-bounces+philip.fennell=bbc.co.uk@lists.mozilla.org
[mailto:dev-tech-xforms-bounces+philip.fennell=bbc.co.uk@lists.mozilla.o
rg] On Behalf Of Aaron Reed
Sent: 19 November 2008 19:11
To: dev-tech-xforms@lists.mozilla.org
Subject: Re: Problems with xf:copy and xf:delete...

Hi Philip,

I believe that xf:copy is working correctly.  Think of it like a normal
xf:select with items.  When you bind a xf:select to a node and then
change the selected item, the value associated with that item replaces
the contents of the node that xf:select is bound to, right?  In this
case, since it is a xf:select and not a xf:select1, you should be able
to select multiple items and they should all be able to exist under the
bound node together.  If that isn't happening then THAT would be a bug.

--Aaron

Philip Fennell wrote:
> As a follow-up, I've noticed that the bind expression for 'entry.tags'
> might be causing the delete problems I was having. That expression 
> points to an attribute node.
> 
> I've re-jigged the form so that the [+] buttons are on one repeat for 
> the 'available' categories and the [-] buttons are on another repeat 
> for the 'selected' categories. Not exactly elegant but it'll do for
now.
> 
> 
> Regards
> 
> Philip Fennell
>> XML Developer (The Forge)
>>
>> BBC Future Media & Technology
>> Media Village, 201 Wood Lane London W12 7TP
>> BC4 C4, Broadcast Centre
>>
>> T:	0208 0085318
>>
> 
> -----Original Message-----
> From: 
> dev-tech-xforms-bounces+philip.fennell=bbc.co.uk@lists.mozilla.org
> [mailto:dev-tech-xforms-bounces+philip.fennell=bbc.co.uk@lists.mozilla
> .o
> rg] On Behalf Of Philip Fennell
> Sent: 19 November 2008 13:35
> To: dev-tech-xforms@lists.mozilla.org
> Subject: Problems with xf:copy and xf:delete...
> 
> Hello,
> 
> I have been working on an XForms enable Atom Publishing Protocol (APP)

> client application for the publication of new Atom entries and I've 
> run into a few problems with the XForms plug-in.
> 
> I'm using:
> 
> Firefox 3.0.4 and Mozilla XForms 0.8.6ff3 on Windows XP SP2
> 
> 
> And here are the problems:
> 
> 1) I use xf:itemset and xf:copy, bound to the categories of the feed 
> (see example below) to control the 'tags' the user can select for 
> their entry via an xf:select. The xf:select is bound to the entry 
> element of the entry instance data. When I select a tag from the list 
> the correct category element is created but the side-effect is that 
> all the other children of the entry (title, link, id, update and 
> content) are deleted and the controls bound to them disappear from the

> view (not surprisingly). If you open the example XForm below you will 
> be able to see the behaviour I've described. There is nothing that I 
> can see in the XForms 1.1 spec that suggests this is the correct 
> behaviour. Note, I tried the same form in FormsPlayer and it didn't 
> delete the other children.
> 
> 2) In order to get around this immediate problem I recreated, rather 
> crudely, the same functionality (see example) by using xf:repeat, some

> xf:trigger elements and some xf:insert and xf:delete actions. This 
> appears to work fine. But, if you comment-out the xf:select, refresh 
> the browser, add a tag with the [+] button then delete it with the 
> corresponding [-] Firefox crashes big-time!
> 
> 
> If anyone else can recreate these then please let me know and I'll 
> raise some bugs in Bugzilla.
> 
> 
> 
> 
> Example XForm:
> ==============
> 
> <?xml version="1.0" encoding="utf-8"?>
> <!-- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
>     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> --> <html 
> xmlns="http://www.w3.org/1999/xhtml"
>     xmlns:app="http://www.w3.org/2007/app"
>     xmlns:atom="http://www.w3.org/2005/Atom"
>     xmlns:ev="http://www.w3.org/2001/xml-events"
>     xmlns:xf="http://www.w3.org/2002/xforms"
>     xmlns:xs="ttp://www.w3.org/2001/XMLSchema"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xml:lang="en"
>     lang="en">
>   <head>
>     <meta name="generator" content="jEdit" />
>     <meta name="author" content="Philip A. R. Fennell" />
>     <meta name="CVS-Id" content="$Id: $" />
>     <!-- <link rel="stylesheet" type="text/css" href="" media="screen"
> /> -->
>     <!-- <script type="text/javascript" src=""></script> -->
>     
>     <xf:model>
>        <!--
>        <xf:action ev:event="xforms-ready">
>         <xf:send submission="getService"/>
>       </xf:action>
>        -->
>       
>       <!-- APP Service Document. -->
>       <xf:submission id="getService"
>           action="/app/service"
>           method="get"
>           replace="instance"
>           instance="service">
>         <xf:header>
>           <xf:name>Accept</xf:name>
>           <xf:value>application/atomsvc+xml</xf:value>
>         </xf:header>
>         <xf:action ev:event="xforms-submit-done">
>           <xf:send submission="getCategories"/>
>         </xf:action>
>       </xf:submission>
>       
>       <xf:instance id="service" xmlns="http://www.w3.org/2007/app">
>         <service xmlns="http://www.w3.org/2007/app" 
>           xmlns:atom="http://www.w3.org/2005/Atom">
>           <workspace>
>             <atom:title>Trees</atom:title>
>             <collection href="/app/entries">
>               <atom:title>Pictures</atom:title>
>               <categories href="/app/tags"/>
>               <accept>application/atom+xml</accept>
>             </collection>
>           </workspace>
>         </service>
>       </xf:instance>
>       
>       <xf:bind id="siteTitle"
> nodeset="instance('service')/app:workspace/atom:title"/>
>       <xf:bind id="siteSubtitle"
>
nodeset="instance('service')/app:workspace/app:collection/atom:title"/>
>       <xf:bind id="acceptsMediaTypes"
> nodeset="instance('service')/app:workspace/app:collection/app:accept"/
> >
>       
>       
>       
>       
>       <!-- Atom Syndication Feed. -->
>       <!-- <xf:submission id="getFeed"
>           resource="../content/feed.atom"
>           method="get"
>           replace="instance"
>           instance="service"/>
>       <xf:instance id="feed" xmlns="http://www.w3.org/2005/Atom"/> -->
>       
>       
>       
>       
>       <!-- Atom Feed Entry. -->
>       <xf:submission id="createResource"
>           method="post"
>           replace="all"
>           instance="entry"
>           ref="instance('entry')">
>         <xf:resource
> value="instance('service')/app:workspace/app:collection/@href"/>
>         <xf:header>
>           <xf:name>Slug</xf:name>
>           <xf:value value="instance('entry')/atom:title"/>
>         </xf:header>
>       </xf:submission>
>       <xf:instance id="entry">
>         <entry xmlns="http://www.w3.org/2005/Atom">
>           <title/>
>           <link href=""/>
>           <id/>
>           <updated/>
>           <content type="text"/>
>         </entry>
>       </xf:instance>
>       
>       <xf:bind id="entry.title"
nodeset="instance('entry')/atom:title"/>
>       <xf:bind id="entry.content"
> nodeset="instance('entry')/atom:content"/>
>       <xf:bind id="entry.categories" nodeset="instance('entry')"/>
>       <xf:bind id="entry.tags"
> nodeset="instance('entry')/atom:category/@term"/>
>       
>       
>       
>       <!-- APP Categories Document. -->
>       <xf:submission id="getCategories"
>           method="get"
>           replace="instance"
>           instance="categories">
>         <xf:header>
>           <xf:name>Accept</xf:name>
>           <xf:value>application/atomcat+xml</xf:value>
>         </xf:header>
>         <xf:resource
> value="instance('service')/app:workspace/app:collection/app:categories
> /@
> href"/>
>       </xf:submission>
>       
>       <xf:instance id="categories" xmlns="http://www.w3.org/2007/app">
>         <app:categories
>           xmlns:app="http://www.w3.org/2007/app"
>           xmlns:atom="http://www.w3.org/2005/Atom"
>           fixed="yes"
>           scheme="http://trees.co.uk/tags">
>           <atom:category term="ash" />
>           <atom:category term="beech" />
>           <atom:category term="birch" />
>           <atom:category term="chestnut" />
>           <atom:category term="hazel" />
>           <atom:category term="oak" />
>         </app:categories>
>       </xf:instance>
>       
>       <xf:bind id="tags"
> nodeset="instance('categories')/atom:category"/>
>     </xf:model>
>     
>     <title>Atom Publishing Protocol Client</title>
>   </head>
>   <body>
>     <h1>XForms Enabled <acronym title="Atom Publishing 
> Protocol">APP</acronym> Client</h1>
>     <div>
>       <h2><xf:output bind="siteTitle"/> &gt; Upload &gt; <xf:output 
> bind="siteSubtitle"/></h2>
>       <xf:group>
>         
>         <xf:group>
>           <xf:input bind="entry.title">
>             <xf:label>Title</xf:label>
>           </xf:input>
>           
>           <xf:group>
>             <xf:textarea bind="entry.content">
>               <xf:label>Content</xf:label>
>             </xf:textarea>
>           </xf:group>
>         </xf:group>
>         
>         <xf:group>
>           <xf:label>Tags</xf:label>
>           <xf:repeat bind="entry.tags">
>             <xf:output ref="."/>
>           </xf:repeat>
>         </xf:group>
>         
>         <xf:group>
>           <xf:select bind="entry.categories" appearance="full">
>             <xf:label>Select</xf:label>
>             <xf:itemset bind="tags">
>               <xf:label ref="@term"/>
>               <xf:copy ref="."/>
>             </xf:itemset>
>           </xf:select>
>         </xf:group>
>         
>         <xf:group>
>           <ul>
>             <xf:repeat id="selector.tags" bind="tags">
>               <li>
>                 <xf:trigger>
>                   <xf:label>+</xf:label>
>                   <xf:action ev:event="DOMActivate">
>                     <xf:insert context="instance('entry')"
> nodeset="atom:category"
>
origin="instance('categories')/atom:category[index('selector.tags')]"/>
>                   </xf:action>
>                 </xf:trigger>
>                 <xf:trigger>
>                   <xf:label>-</xf:label>
>                   <xf:action ev:event="DOMActivate">
>                     <xf:delete context="instance('entry')"
> nodeset="atom:category" at="index('selector.tags')"/>
>                   </xf:action>
>                 </xf:trigger>
>                 <xf:output ref="@term"/>
>               </li>
>             </xf:repeat>
>           </ul>
>         </xf:group>
>         
>         <!--<xf:group>
>           <xf:submit submission="createResource">
>             <xf:label>Publish</xf:label>
>             <xf:hint>Publish you new entry</xf:hint>
>           </xf:submit>
>         </xf:group>-->
>       </xf:group>
>       
>     </div>
>   </body>
> </html>
> 
> 
> 
> 
> 
> Regards
> 
> Philip Fennell
>> XML Developer (The Forge)
>>
>> BBC Future Media & Technology
>> Media Village, 201 Wood Lane London W12 7TP
>> BC4 C4, Broadcast Centre
>>
>> T:	0208 0085318
>>
> 
> http://www.bbc.co.uk/
> This e-mail (and any attachments) is confidential and may contain 
> personal views which are not the views of the BBC unless specifically 
> stated.
> If you have received it in error, please delete it from your system.
> Do not use, copy or disclose the information in any way nor act in 
> reliance on it and notify the sender immediately.
> Please note that the BBC monitors e-mails sent or received.
> Further communication will signify your consent to this.
> 					
> _______________________________________________
> dev-tech-xforms mailing list
> dev-tech-xforms@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-xforms
> 
> http://www.bbc.co.uk/
> This e-mail (and any attachments) is confidential and may contain
personal views which are not the views of the BBC unless specifically
stated.
> If you have received it in error, please delete it from your system.
> Do not use, copy or disclose the information in any way nor act in
reliance on it and notify the sender immediately.
> Please note that the BBC monitors e-mails sent or received.
> Further communication will signify your consent to this.
> 					
_______________________________________________
dev-tech-xforms mailing list
dev-tech-xforms@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-xforms

http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
					
Received on Thursday, 20 November 2008 09:30:13 GMT

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