W3C home > Mailing lists > Public > www-forms@w3.org > April 2005

RE: How can a text file be uploaded by XForms?

From: Ogbuji, Chimezie <OGBUJIC@ccf.org>
Date: Fri, 22 Apr 2005 12:45:06 -0400
Message-ID: <E9B52E50D32640449D84BD2A85F9CADF12A6D2@CCHSCLEXMB60.cc.ad.cchs.net>
To: www-forms@w3.org

The approach that I have found to work for this specific scenario (where
I need to submit XML content to an endpoint as instance data), is to
base64 encode/decode the XML content within the Forms using a javascript
encoding library.  Some examples:

http://burntelectrons.org/moz/base64.html

There is another one in the Orielly Javascript and DHTML Cookbook
(http://www.oreilly.com/catalog/jvdhtmlckbk/)


The advantage of this is that you can have your content automatically
encoded by the XForms processor by associating an xf:upload with the
instance.  Where you prefer the data is entered as text, I use a binding
from the entered text to a node with the base64 encoded content via an
XPath expression that makes use of an encoding function (formsPlayer
allows you to use user-specified javascript functions within your XPath
expressions).

For example:

<xforms:bind 
  nodeset='.. path to node where base64 encoded content will lie..'
type='xsd:base64Binary' calculate='inline:encodeBase64(string(.. path to
node containing XML text ..))'>
</xforms:bind>





-----Original Message-----
From: www-forms-request@w3.org [mailto:www-forms-request@w3.org] On
Behalf Of Victor Engmark
Sent: Friday, April 22, 2005 3:23 AM
To: Mark Birbeck
Cc: 'Kianoush Eshaghi'; www-forms@w3.org
Subject: Re: How can a text file be uploaded by XForms?


Mark Birbeck wrote:

>Kianoush,
>
>Can I just check that I understand the issue? Are you saying that you
want
>to upload the file 'as is'? That is, you don't want to see it to be
stored
>in a binary or hex format?
>
>If so, then I am afraid that can't be done in XForms 1.0, although it
>certainly wouldn't be difficult to do. At the moment the specification
says
>that you must bind to an element with a schema type of one of the
binary
>types -- which is why formsPlayer correctly "cries" if you use a type
of
>xsd:string ;).
>
>However, just having the raw text is certainly a good suggestion for
XForms
>1.1.
>  
>
I'd expect that you still would have to escape characters in /some/ way,

unless you have specialized parsers which know to treat XForms instance 
data. With this in mind, the most obvious encodings which come to mind
are:

    * Just escaping <, &, and > as &lt;, &amp;, and &gt; (this is not
      complete enough to handle all data, but should be enough for most
      non-binary stuff)
    * The above generalized to XHTML - That is, including entities like
      &copy; without messing up the parsing of the XML (can this be done
      with a DTD?)
    * Generalized even further to escape other non-valid characters,
      such as mentioned in message-ID <4267FF98.8030803@bruchez.org> (is
      this sufficient to handle any binary data?)

Frankly, these encodings are IMNSHO so obvious that I'm starting to 
suspect that my understanding of the concept of "encoding" is 
fundamentally flawed. If this is not the case, how come these encodings 
have not been included in XForms 1.0? They would be very useful to be 
able to display the raw data that is sent with a form, and for e.g. web 
authoring XForms (preview of result).


Chimezie Thomas-Ogbuji
Lead Systems Analyst
Department of Cardiovascular Surgery
Cleveland Clinic Foundation
E: ogbujic@ccf.org
P: (216)444-8593

------------------------------------------------------------------------------
Confidentiality Note:  This message is intended for use only by the individual or entity to which it is addressed and may contain information that is privileged, confidential, and exempt from disclosure under applicable law.  If the reader of this message is not the intended recipient or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.  If you have received this communication in error,  please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy.  Thank you.
------------
Visit us online at our award-winning http://www.clevelandclinic.org for a complete listing of Cleveland Clinic services, staff and locations from one of the country's leading hospitals.
==============================================================================
Received on Friday, 22 April 2005 17:41:09 GMT

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