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

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

From: Klotz, Leigh <Leigh.Klotz@XEROX.COM>
Date: Thu, 21 Apr 2005 10:30:43 -0700
Message-ID: <E254B0A7E0268949ABFE5EA97B7D0CF44C6155@usa7061ms01.na.xerox.net>
To: "Mark Birbeck" <mark.birbeck@x-port.net>, "Kianoush Eshaghi" <Kianoush.Eshaghi@metadat.at>, <www-forms@w3.org>

The submission method multipart-related is designed to upload files as
MIME attachments, outside the instance.
The bound node will contain a URL that refers to the MIME part.
See http://www.w3.org/TR/xforms/slice11.html#serialize-multipart 

 <xf:model>
 	<xf:instance>
 		<request>
 			<description/>
 		</request>
 	</xf:instance>
 	<xf:bind id="des" nodeset="/request/description"
type="xsd:anyURI"/>
      <xf:submission id="request" method="multipart/related"
action="http://www.example.com/cgi-bin/request.cgi" />
 </xf:model>
 
 <xf:upload bind="des">
 	<xf:label>Select the file</xf:label> 
 </xf:upload> 
 <xf:submit
submission="request"><xf:label>Request</xf:label></xf:submit>
 
Leigh.

-----Original Message-----
From: www-forms-request@w3.org [mailto:www-forms-request@w3.org] On
Behalf Of Mark Birbeck
Sent: Thursday, April 21, 2005 10:19 AM
To: 'Kianoush Eshaghi'; www-forms@w3.org
Subject: RE: How can a text file be uploaded by XForms?


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.

By the way, once the data is copied in, are you then going to submit it
to a server? Or are you going to do something else. I ask only to try
and understand what you are trying to do, in case there is another way
round it.
(For example, a quick resolution would be to use an XPath extension
function to 'unencode' the base64 data back to text. A bit long-winded,
I know, but it may address your issue for now.)

Regards,

Mark


Mark Birbeck
CEO
x-port.net Ltd.

e: Mark.Birbeck@x-port.net
t: +44 (0) 20 7689 9232
w: http://www.formsPlayer.com/
b: http://internet-apps.blogspot.com/

Download our XForms processor from
http://www.formsPlayer.com/ 

> -----Original Message-----
> From: www-forms-request@w3.org
> [mailto:www-forms-request@w3.org] On Behalf Of Kianoush Eshaghi
> Sent: 21 April 2005 16:38
> To: www-forms@w3.org
> Subject: How can a text file be uploaded by XForms?
> 
> 
> Hi everybody!
> 
> I have implemented a form using XForms, whereby I use IE Plug-In 
> (FormsPlayer 1.3). I want to built some control element in the form 
> control, which enable to upload some text file (with extend .txt) into

> some node of my XML instance.
> I've used <xforms:upload/> in my form control, and set the type of 
> node in instance as type="xsd:base64Binary"
> as following:
> 
> <xf:model>
> 	<xf:instance>
> 		<request>
> 			<description/>
> 		</request>
> 	</xf:instance>
> 	<xf:bind id="des" nodeset="/request/description"
> type="xsd:base64Binary"/>
> </xf:model>
> 
> <xf:upload bind="des">
> 	<xf:label>Select the file:</xf:label> </xf:upload> <xf:output 
> bind="des"/>
> 
> But I get as xml instance (output control) after uploading of the text

> file some other encoded symbols.
> 
> How can I upload the content of the text file without any encoding at 
> the text into instance? I have tried with "xsd:string", but the 
> FormsPlayer cries ;-( that the instance is invalid.
> 
> I appreciate your tips and pointers.
> 
> freundliche Gruesse / best regards
> Dipl.-Ing. Kianoush Eshaghi     T +43 1 74040-652
> METADAT - The Architect for Knowledge Networks
> 
> 
> 
> 
Received on Thursday, 21 April 2005 17:31:10 GMT

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