Re: [Xsltforms-support] obtaining XML from the user - possible? impossible?
Brought to you by:
alain-couthures
From: Alain C. <ala...@ag...> - 2012-07-07 19:19:49
|
Hello Michael, > A rather general question has come up. A friend has asked > for a form that asks the user some questions based on the content > of an XML document to be supplied by the user. > > Is there any convenient way to get an XML document that > initially resides on the user's hard disk into an XForms > instance, so the form can look at it and customize itself > accordingly? Or is that impossible? Yes, you can use a submission at "file://" for reading and writing local files. For security reasons, you will always get a File dialog (I could allow a direct access to local files when no distant HTTP server is used, what do you think?). I have already designed some basic XML editor with this. > > If xf:upload were able to populate an instance (or an element > in an instance) with an uploaded document, that would (I > think) do what I think I need. But if I read the 1.1 spec correctly, > xf:upload data cannot be parsed XML data, only base64Binary > and so on. Yes, xf:upload is just for content. > > I'd be happy to provide a text widget and have the user copy > the file and paste it in, if there were a way to get the parsed XML > structure back out, but that has not worked for me in the past. > (On the other hand, I think that that is, more or less, how the > TinyMCE widget works, so it might be technically feasible.) A textarea control could be used and a schema type could activated this. It could then be possible to validate the content when it is well-formed. Validating it according to a schema would be more complex for XSLTForms... > > Does anyone here have relevant experience or advice? Another possibility would be to define and use some parse() function (the W3C Work Group has not yet decided what to specify)... The problem is to know if the resulting XML document would be effective as some automatically generated instance or if it would just exist during an action processing. Thank you for your comments and suggestions! -Alain |