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

Hi Kianoush,

The problem is that you can't treat the file content as
a black box unless it is encoded, e.g. with base 64 or hex binary.

Assume the contrary, that you can upload the file content
into a node as clear text.

If it contains XML, you are saying you want it to be a black box,
but if you submit that instance to a server (or file) then reload
the instance, then the file content stops being a black box.
There is no way to avoid this inconsistent behavior.

If the file content contains characters that are illegal XML
content, then placing the content clear text into a node and
then submitting results in either a serialization failure or 
a subsequent XML parse failure on the part of the submit receiver.

As a variation of this, if the file contains well-formed XML and
you put it clear text into an attribute node, then again the result
is an eventual serialization or parse failure.

Finally, I think you missed the point of my question about encoding,
because you said it should be encoded as XML.  I mean encoding as
in the encoding attribute on an XMLDecl.  In other words, you want 
the file content to be placed into an instance node.  Well, to do that
one has to convert the file from its binary format into essentially
a sequence of UCS characters (i.e. one needs data in a format that
conforms to the XPath data model).  How do you get from the binary to
a sequence of UCS characters unless you know what encoding the file 
is in?  Is it in UTF-8, UTF-16, shift-jis, iso-8859-2, etc.?

These are (at least some of) the reasons why the feature doesn't
exist and why it will be hard to add any time soon.

Cheers,
John Boyer, Ph.D.
Senior Product Architect and Research Scientist
PureEdge Solutions Inc.


-----Original Message-----
From: Kianoush Eshaghi [mailto:Kianoush.Eshaghi@metadat.at]
Sent: Thursday, April 21, 2005 11:31 AM
To: John Boyer
Cc: Mark.Birbeck@x-port.net
Subject: AW: How can a text file be uploaded by XForms?




 Hi john,
> 
> If upload is allowed to put well-formed XML into a node,
> the next question that arises is whether that content
> should be treated as black-box data or whether it should be 
> treated as parseable data that should result in a rebuild
> and an attachment of UI controls and binds and such to 
> the uploaded data.

The content of uploaded file should be treated as black-box

> Finally, a different facet of the above issue is to determine
> what happens if the file content is not XML.  What encoding
> should it be interpreted as having?

It should be interpreted as having XML, simply I want to have the text raw (XML or no XML), which comes from the uploaded file, in my instance.
  
> -----Original Message-----
> From: www-forms-request@w3.org [mailto:www-forms-request@w3.org]On
> Behalf Of Kianoush Eshaghi
> Sent: Thursday, April 21, 2005 10:44 AM
> To: www-forms@w3.org
> Cc: Mark.Birbeck@x-port.net
> Subject: WG: How can a text file be uploaded by XForms?
> 
> 
> 
> 
> Mark
> 
> > 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?
> 
> I want see it in my instance as like as the content of the file, which
> has been uploaded, for example:
> 
> I have a file, which contains following text data:
> <xx>
> 	<YY/>
> 	<ZZ/>
> 	...
> 	...
> </xx>
> If I submit the form, I want to have the following instance:
> <request>
> 	<description>
> 		<xx>
> 		<YY/>
> 		<ZZ/>
> 		...
> 		...
> 		</xx>
> 	</description>
> </request>
> 
> > 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.
> 
> First I want to create respective XML instances, and to save it into
> local file system, how I am going as following
> <xf:submission method="put" action="file:C:/result.xml"/>
> It works well. But If I try to use http in
> action="http://localhost/result.xml" method="put", I will get the HTTP
> Error message that resource(?) isn't permitted(?)
> 
> Second I want to send the created XML instance to a particular XML Web
> Services, which is installed on tomcat server. I've tried 
> <xf:submission
> method="post" action="http://localhost:8080/CART"/>, but it 
> hasn't also
> gone ;-((
> 
> > (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.)
> 
> hi, good idea, but I am new by XPath, Could you point me according to?
> 
> Kianoush
> 
> > 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 21:13:23 UTC