W3C home > Mailing lists > Public > www-forms@w3.org > August 2010

Re: data export for subsequent transformation to csv

From: e-letter <inpost@gmail.com>
Date: Fri, 13 Aug 2010 10:07:20 +0100
Message-ID: <AANLkTi=ndBFgy=PvZJawanc2qR9TjH1aBJK+m_hbc+0L@mail.gmail.com>
To: Leigh L Klotz Jr <leigh.klotz@xerox.com>
Cc: www-forms@w3.org
On 12/08/2010, Leigh L Klotz Jr <leigh.klotz@xerox.com> wrote:
>I hope this message reaches you as your email address doesn't seem accurate, but perhaps you'll see it on the list.
>
I looked at the mail archive but could not see any messages for this month?

>There are a couple of issues with your form:
>
>1. The instance should start out with elements for all the elements you want in the result.  In general, XForms form controls only change the text values of elements and attributes, and don't add them.  (There are a few cases where they do get added by controls and actions, but in the case of your form, they don't.)
>
Referring to the w3 document 'xforms11', an example model element is produced:

<xforms:model>
  <xforms:instance>
    <ecommerce xmlns="">
      <method/>
      <number/>
      <expiry/>
    </ecommerce>
  </xforms:instance>
  <xforms:submission action="http://example.com/submit" method="post"
id="submit" includenamespaceprefixes=""/>
</xforms:model>

and applied to an html document:

...
<select1 ref="method">
  <label>Select Payment Method:</label>
  <item>
    <label>Cash</label>
    <value>cash</value>
  </item>
  <item>
    <label>Credit</label>
    <value>cc</value>
  </item>
</select1>
...

I concluded from this example that if I create an element 'testform'
with a namespace 'generalinformation', the element 'select1' with
attribute 'ref='generalinformation'' could be applied. This did not
work so I removed the attribute 'ref'.

>2. The use of namespaces in the instance isn't quite right.   You might want to read up on an XML book on the topic, or just take a look at what I've done and generalize.
>
>3. Each form control needs a "ref" attribute with the path to the element in the instance where you want the data placed.   I've put some in that work, but you can of course change the instance data around.  If you need to move the elements down a level inside other elements, you'll need to use the XPath syntax "a/b/c" to get to element "c" inside "b" inside "a".  In XForms, you get the toplevel element name for free.
>
>That ought to be make it work.  Here's the output I got once I made those changes:
>
><generalinformation><purpose>Building</purpose><weatherLlocation>London</weatherLocation></generalinformation>
>
>Here's the updated form, and below that are some enhancements you might consider:
>
><?xml version="1.0" encoding="UTF-8"?>
><html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms">
>  <head>
>    <style type="text/css">
>      code {text-color:black; background:white; font-family:verdana, sans-serif}
>    </style>
>    <xf:model>
>      <xf:instance>
>        <generalinformation xmlns="">
>          <purpose />
>          <weatherLocation />
>        </generalinformation>
>      </xf:instance>
>      <xf:submission resource='file:testgeneral.xml' method="put" id="gi" />
>    </xf:model>
>    <title>
>      test xml to csv for postgresql
>    </title>
>  </head>
>  <body>
>    <p>
>      <xf:select1 ref="purpose" appearance='minimal'>

The addition of the attribute 'ref' causes the list menu to disappear
(tested in firefox version 2009, 304, 36rc2 and now using 368, all
with suitable versions of the xforms plugin). All that appears is the
button icon labelled 'send'. When I remove the attribute 'ref', the
list menu reappears.

René.
Received on Friday, 13 August 2010 09:07:52 GMT

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