create (and write into) an xml file from data given in a form

D

despo

Hi
I am sorry if this is discussed elsewhere, but I have searched a lot
and could not find anything concrete (for my standards of course). I
have found a lot of examples of how to write in xml tagged format, but
all of them seem to print in alert boxes or similar, so I cannot see
how I can CREATE a new xml file. Also I have found a lot about
creating ActiveXObjects (IE targets), but this is not what i want.

I would be grateful if somebody could help me on this. To be more
exact, i would like something of the form
- create new file of name "newfile.xml"
- write "anything" in "newfile.xml"

thanks a lot in advance
 
T

Thomas 'PointedEars' Lahn

despo said:
I am sorry if this is discussed elsewhere, but I have searched a lot
and could not find anything concrete (for my standards of course).

Naming the parameters of your search would have helped us to suggest better
ones.
I have found a lot of examples of how to write in xml tagged format, but
all of them seem to print in alert boxes or similar, so I cannot see
how I can CREATE a new xml file. Also I have found a lot about
creating ActiveXObjects (IE targets), but this is not what i want.

ActiveX/COM objects are certainly one way to go (not only for Internet
Explorer). What else do you want, then?
I would be grateful if somebody could help me on this. To be more
exact, i would like something of the form
- create new file of name "newfile.xml"
- write "anything" in "newfile.xml"

As this requires the use of host objects, it is nearly impossible to say
without you stating your requirements, especially the target runtime
environments.

<http://jibbering.com/faq/#posting>


PointedEars
 
M

Matěj Cepl

Dne 18.12.2009 18:01, despo napsal(a):
I am sorry if this is discussed elsewhere, but I have searched a lot
and could not find anything concrete (for my standards of course). I
have found a lot of examples of how to write in xml tagged format, but
all of them seem to print in alert boxes or similar, so I cannot see
how I can CREATE a new xml file. Also I have found a lot about
creating ActiveXObjects (IE targets), but this is not what i want.

Depends on what you browsers you need to support. If not archeological
excavations (i.e., IEs ;)), then maybe http://en.wikipedia.org/wiki/E4X
might be helpful. See for example https://developer.mozilla.org/en/E4X.
Otherwise, in the old bad days, I am afraid, you just used
document.write a lot and wrote all your tags one by one.
I would be grateful if somebody could help me on this. To be more
exact, i would like something of the form
- create new file of name "newfile.xml"
- write "anything" in "newfile.xml"

well, concerning creating the file, you have a problem with creating any
new file from scratch. First decide what file you want ... if you mean
like real file on the local harddrive, then it is kind of complicated,
otherwise if you want a chunk of data formatted as XML send over the
wire somewhere, it is easy.

Concerning searializing forms, join the party on the current thread
"caching submitted form while we are offline?"

Matěj

--
http://www.ceplovi.cz/matej/, Jabber: mcepl<at>ceplovi.cz
GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC

I didn't attend the funeral, but I sent a nice letter saying
I approved of it.
-- Mark Twain
 
T

Thomas 'PointedEars' Lahn

Matěj Cepl said:
Dne 18.12.2009 18:01, despo napsal(a):

Depends on what you browsers you need to support. If not archeological
excavations (i.e., IEs ;)), then maybe http://en.wikipedia.org/wiki/E4X
might be helpful. See for example https://developer.mozilla.org/en/E4X.
Otherwise, in the old bad days, I am afraid, you just used
document.write a lot and wrote all your tags one by one.

E4X is merely a syntax extension. It does _not_ *create files*, neither
does document.write(). If you were talking about server-side scripting,
then E4X might be an option for efficiently writing the data with e.g.
write(). But you would still need a host object (e.g. File) to do it.


PointedEars
 
D

despo

Thank you all so much
ActiveX/COM objects are certainly one way to go (not only for Internet
Explorer). What else do you want, then?

OK, I got the impression that ActiveXObjects worked only for IE. I am
interested mainly for firefox (meaning i want what this web page to
work in any environment, but if it cannot, i would prefer it to be
functional in firefox).

i tried to set e4x in the script declaration, but it does not seem to
change anything. And somewhere i read that it is not needed.
E4X is merely a syntax extension. It does _not_ *createfiles*, neither
does document.write(). If you were talking about server-side scripting,
then E4X might be an option for efficiently writing the data with e.g.
write(). But you would still need a host object (e.g.File) to do it.

So you mean, I should create a file, which will be used to write on
data temporarily. Then if I guess I have to allocate some space for
its potential size, right? How can i do that?
As this requires the use of host objects, it is nearly impossible to say
without you stating your requirements, especially the target runtime
environments.

Well, I understand that an user that uses a web site for some
calculations cannot have the permission to write in the server that
hosts the web site. But what if the user had the permission to create
a temporary file; then if he wants to save it in his hard disk, then
he has the possibility to do it, otherwise the file would be deleted
permanently. I believe there must be such a possibility, it's only i
don't know how to explain it better. Imagine some form you submit with
your personal data. On submission, the data are processed somehow, but
also the user has thew right to see what he filled in in this form.
well, concerning creating the file, you have a problem with creating any
new file from scratch. First decide what file you want ... if you mean
like real file on the local hard drive, then it is kind of complicated,
otherwise if you want a chunk of data formatted as XML send over the
wire somewhere, it is easy.

I think that this is what i describe above, isn't it? Data formatted
as xml sent saved in the user's hard disk, or sent to an email
address. I am sorry, but i guess my vocabulary in this field a bit
limited.
Concerning searializing forms, join the party on the current thread
"caching submittedformwhile we are offline?"

thanks, but i checked it out, it is a bit too much for me.. ;)

Well, I think that I can prepare a very simple sample file of what i
want to do. Thank you a lot!

d
 
T

Thomas 'PointedEars' Lahn

despo said:
Thank you all so much

Thank you for not deleting the attribution lines next time, and for posting
the followup exactly to what you are referring to, not just somewhere in the
thread as you did here.
OK, I got the impression that ActiveXObjects worked only for IE.

They do not. What matters are the capabilities of the runtime environment,
not the name of the browser.
I am interested mainly for firefox (meaning i want what this web page to
work in any environment, but if it cannot, i would prefer it to be
functional in firefox).

In that case you might want to look into XPCOM, the Cross-Platform Component
Object Model provided by Mozilla. It can be used in a privileged
environment, like a Gecko-based application which would use XUL.
i tried to set e4x in the script declaration, but it does not seem to
change anything. And somewhere i read that it is not needed.

IIRC, it is no longer needed for recent versions of Firefox.
So you mean, I should create a file, which will be used to write on
data temporarily.

I do not know yet what exactly you want to accomplish, so I have not made
any recommendation yet.
Then if I guess I have to allocate some space for its potential size,
right? How can i do that?

Try to clarify what you are trying to accomplish before jumping to further
conclusions.
Well, I understand that an user that uses a web site for some
calculations cannot have the permission to write in the server that
hosts the web site.

That is incorrect if "write in the server" means "write access to the
server's filesystem". A user can be granted restricted access to certain
areas of that filesystem if necessary.
But what if the user had the permission to create a temporary file;

They already have: on the client-side, in memory, so to speak.
then if he wants to save it in his hard disk, then he has the possibility
to do it, otherwise the file would be deleted permanently. I believe there
must be such a possibility,

Now we are finally talking. So you want the *user* to initiate the Save
operation? That can be arranged. Using DOM methods (but with XML, better
not document.write()) is the first step to a client-side solution, creating
a temporary document in memory (not a file), which can be saved as a file in
the user's local filesystem.
it's only i don't know how to explain it better. Imagine some form you
submit with your personal data. On submission, the data are processed
somehow, but also the user has thew right to see what he filled in in
this form.

But that is what *server-side* scripting has been devised for. Assuming you
want to store the submitted data somewhere on the server-side, you should
generate, with a server-side application, in the same process, an XML
document that contains the submitted data, and serve it via HTTP (either
automatically or on user request). Because you cannot be sure that the data
was successfully transmitted from the client side. How you would do it
would depend on your server-side environment.
I think that this is what i describe above, isn't it? Data formatted
as xml sent saved in the user's hard disk,

Saving files, however, is usually something that only a user can do, on the
client-side. You/the server side can only provide the data to be saved.
or sent to an email address.

That needs to be done from the server-side instead because you cannot assume
the user has a suitable e-mail client installed or, if installed, that you
could trigger it from the Web browser or another application.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top