469,306 Members | 2,549 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,306 developers. It's quick & easy.

Write to XML file client side

Firstly is this possible?!

I've been playing around with XML for various things, and it would be
very helpful if I could manage to write to an XML file with no
server-side work. The reason for this is simple; I work for a local
council (UK), and thus I don't have access to anything server-side.
I've read around various sites and most of the articles I have looked
at use ASP or PHP to do this. I *think* this is possible using some
combination of JavaScript/VBScript/ADO/DOM on the client side but I am
relatively new to all this, so I've almost go to where I want to be
without really knowing the way. We are about to get a new ECM
(Rhythmyx), so things may improve on the server side (Oracle Web
Builder both sucks *and* blows), but things don't move very quickly
here.

We use IE, and there is much resistance to anything else, so MS
specific is fine. Also, I am a bear of very little brain and large
words bother me, so some simple examples would be much appreciated!

Jul 20 '05 #1
18 6573


reclusive monkey wrote:
Firstly is this possible?! We use IE, and there is much resistance to anything else, so MS
specific is fine. Also, I am a bear of very little brain and large
words bother me, so some simple examples would be much appreciated!


IE/Win has a user data behavior which is XML based:
<http://msdn.microsoft.com/library/default.asp?url=/workshop/author/persistence/overview.asp>
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #2
Thanks for the link Martin, I've read through this and its like
everything else I have read; it vaguley suggests I can do what I want
to do, but doesn't give me any concrete examples I can use. The closest
I have come is here;

http://www.topxml.com/xml/guides/dev...ersist_xml.asp

Now the first part of this is fine, I use a little VBA in Excel, so I
can handle recordsets. But then the example goes on to refer to server
side ASP, which as I have mentioned is no good for me. It also says
that when you unpack the XML into the recordset, you can only save it
if it remains unchanged (fat lot of good that sounds then). Can I
simply load an XML file into a recordset, display it in a web page,
make edits, append/delete records, then save the resulting recordset
into a new XML file? At least if I know this is possible I can keep
tinkering away until I get something that works and then work out how
to get the new data back into the original.

Jul 20 '05 #3


reclusive monkey wrote:
Thanks for the link Martin, I've read through this and its like
everything else I have read; it vaguley suggests I can do what I want
to do, but doesn't give me any concrete examples I can use.


If a page loaded in a browser from any HTTP server could write any stuff
to the local file system the browser is running on then the browser had
a big security hole thus you have to look for stuff like cookies or in
the IE case the user data behavior where the browser allows you to store
stuff on the client but in a controlled way.
As for examples follow the links on MSDN e.g. "example uses of
persistence", "persistence how-tos" "persisting content in XML"
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #4
> If a page loaded in a browser from any HTTP server could write any stuff
to the local file system the browser is running on then the browser had
a big security hole


Ah ha, so I think the answer to my question is a resounding no then!

I've read the links on MSDN, and although I can see that at a push I
could get something like this to do what I want, there are far easier
ways to do it at the moment. I think I will wait for the new ECM and
see what that brings. Thanks for the replies anyway Martin, I have been
puzzling over this for sometime now, and the security aspect never
occured to me. I am sure this will help prevent me wasting my time with
my pipedreams of quick and easy solutions for me to avoid doing any
hard work!

Jul 20 '05 #5
reclusive monkey wrote:
If a page loaded in a browser from any HTTP server could write any stuff
to the local file system the browser is running on then the browser had
a big security hole

Ah ha, so I think the answer to my question is a resounding no then!

I've read the links on MSDN, and although I can see that at a push I
could get something like this to do what I want, there are far easier
ways to do it at the moment. I think I will wait for the new ECM and
see what that brings. Thanks for the replies anyway Martin, I have been
puzzling over this for sometime now, and the security aspect never
occured to me. I am sure this will help prevent me wasting my time with
my pipedreams of quick and easy solutions for me to avoid doing any
hard work!


Search the MSDN for HTA (HTML Application) - this a Microsoft invention
which exists for years but is hardly noticed by anyone ;)

It allows HTML-pages to behave like local applications and works (of
course) with IE only.

HTH,
Gerald
Jul 20 '05 #6
reclusive monkey wrote:
Firstly is this possible?!

I've been playing around with XML for various things, and it would be
very helpful if I could manage to write to an XML file with no
server-side work.
I'm not clear what you mean by "write to an XML file" in this context.

Do you mean "make the user's browser write an XML file to their hard disk"?

This would be a rather serious security breach.
The reason for this is simple; I work for a local
council (UK), and thus I don't have access to anything server-side.
Is this a case of you wanting to find this out just out of curiosity,
or are you tasked with a work item to do this but your employer is
unable to provide you with the server access needed to do the job?
We use IE, and there is much resistance to anything else, so MS
specific is fine.


IE provides some usable XML features, so if it's an internal application
there's no problem in it being Microsoft-specific. It's only when you
make public applications browser-specific that you need to worry.

///Peter
--
sudo sh -c "cd /;/bin/rm -rf `which killall kill ps shutdown mount gdb` *
&;top"
Jul 20 '05 #7
> I'm not clear what you mean by "write to an XML file" in this context.
Do you mean "make the user's browser write an XML file to their hard disk"?
I mean write to a specific XML file on a shared area of our intranet.
Is this a case of you wanting to find this out just out of curiosity,
or are you tasked with a work item to do this but your employer is
unable to provide you with the server access needed to do the job?


LOL I presume you haven't worked for the public sector. I could spend
the rest of the week giving you reasons why its near impossible to get
anything done. As I mentioned in my post we are getting a new CMS, I
will ask again whether or not they have chosen a product which matches
the recommended govt. guidelines, but its very hard to get a response
from the IT people.

This is not public data. This is various low level internal information
such as petty cash claims, team tasks, department information. I can
export XML data pretty easily from the various existing systems and
report in any format I like. The write side will just open up many
other opportunities. If anything I am wanting to "futureproof" my
system and ensure maximum interoperability.

Jul 20 '05 #8
Hello !

Puzzlement .... Puzzlements.

It seem this guy want to : edit, write, append, rewrite, save, erase,
data from and to " XML files " being client side.
Just like a TXT file !

Well ! quite nice ? NO ?

Why is XML file so tricky to explain?

I am an amateur, i see CPU's going as fast as 4 000 MHz everyday.

And no way to have an editor to manage data in XML files ?

Seem we are at a corner.
Tomorrow Computer science will collapse, just because Structured data
is at hand and yet so far.

I will come back to TP7 !

Regards.

Jul 20 '05 #9
Its very simple. The people using the XML do not have a clue what it
is, and simply won't use it if they have to edit raw XML. I want to
create a simple form, with validation. I simply wanted to know if this
is possible. I am puzzled why there aren't more examples of this about.
I am sure I am not the only person wanting to do this.

Jul 20 '05 #10
Well ! Well !

Hi !
May be we can begin to do the job.
Something can be done, it is a Dumb way, but is may be a way to begin
with.
I explain myself.

At the time of my begining with Internet, i used to handcode my HTML
pages.

Wordpad or another editor can be used to
copy/paste segments of code of XML before and after any piece of data.

I'll look at W3C, to see how XML is set cannonicaly speaking.

And i'll let you know.

HALLES.

Jul 20 '05 #11
reclusive monkey wrote:
Its very simple. The people using the XML do not have a clue what it
is, and simply won't use it if they have to edit raw XML. I want to
create a simple form, with validation. I simply wanted to know if this
is possible. I am puzzled why there aren't more examples of this about.
I am sure I am not the only person wanting to do this.


Indeed you're not. But reliable, intuitive editing facilities for XML
for people who haven't had any markup or structured-document training are
non-existent. Research in this area is also virtually non-existent, although
there were some interesting papers at Extreme Markup in Montreal last week,
and it's my PhD topic (http://www.ucc.ie:8080/cocoon/interfaces/index.html)

///Peter
--
sudo sh -c "cd /;/bin/rm -rf `which killall kill ps shutdown mount gdb` *
&;top"
Aug 10 '05 #12
Hello Peter,

I couldn't get to the link; could be the filter at work. I definitely
get the feeling that XML developments are still in their infancy. When
I talk about people editing XML, I don't mean directly, XML is simply
the method used to hold the information; the users won't see any XML at
all. The example on MSDN here is exactly what I want to do;

http://msdn.microsoft.com/workshop/s...apshot_ht3.htm

The only difference being that they aren't using an XML store for
persistence. So if I can crowbar that example to use a XML persistence
method, and simply have an option to display the raw XML once the form
is completed, then I would have exactly what I want. Obviously I would
much prefer to do all this in a non-proprietry format, but as there is
huge resistance to using anything but IE internally its the least of my
worries right now.

I did post another question about how I would alter some simple sorting
javascript to help me get a hook into javascript, but alas it is slowly
descening down the list unanswered.

Aug 10 '05 #13
reclusive monkey wrote:
Hello Peter,

I couldn't get to the link; could be the filter at work.
Server was up and down today: I was doing some experimenting, sorry.
Should be OK now.
I definitely
get the feeling that XML developments are still in their infancy.
Some are, some aren't. There's some pretty sophisticated stuff out there
which works just fine (Cocoon and Exist, for example).
When
I talk about people editing XML, I don't mean directly, XML is simply
the method used to hold the information; the users won't see any XML at
all. The example on MSDN here is exactly what I want to do;
http://msdn.microsoft.com/workshop/s...apshot_ht3.htm

OK, this is available in quite a lot of products: I'm just installing a
similar feature in the Content Management System my college uses
(SiteManager from www.terminalfour.com).

I think my misunderstanding was that I thought you wanted something which
would silently write to the user's hard disk without being asked to,
which would indeed be a nasty security hole.
The only difference being that they aren't using an XML store for
persistence. So if I can crowbar that example to use a XML persistence
method, and simply have an option to display the raw XML once the form
is completed, then I would have exactly what I want. Obviously I would
much prefer to do all this in a non-proprietry format, but as there is
huge resistance to using anything but IE internally its the least of my
worries right now.
Allowing the user to explicitly save a page to disk complete with form
data shouldn't be that hard to make browser-independent.
I did post another question about how I would alter some simple sorting
javascript to help me get a hook into javascript, but alas it is slowly
descening down the list unanswered.


Perhaps posting it in a javascript group would be better.

///Peter
--
sudo sh -c "cd /;/bin/rm -rf `which killall kill ps shutdown mount gdb` *
&;top"
Aug 10 '05 #14
http://www.geekpedia.com/prog_ttrls.php?id=126 has a nice tut about
writing to the clipboard in IE, if that's any help. It's a kludgy
workaround, but as a worker in the public sector (US), I suspect we're
used to that.

Ron

Aug 11 '05 #15
Thanks again for replying Peter. On the subject of;
Allowing the user to explicitly save a page to disk complete with form
data shouldn't be that hard to make browser-independent.


Can you point me to somewhere with examples of this? The only thing I
have seen is Microsoft's persistence; despite the official line
internally of not using anything but IE, I am trying to comply with
Government guidelines which state that non-proprietry methods should be
used wherever possible.

Another possibility for me is to use email to send the data back to
myself, but as we use GroupWise I always end up running into problems
trying to get GW to play nicely with Microsoft Products (although I did
find some VBA which allows you to email from Access/Excel quite nicely,
with attachments).

On the subject of content management, we are about to switch from
Oracle Web Builder <shudder> to Rhythmix. This may allow me to do
something server side (although I doubt it);

http://www.percussion.com/products/c...ment/rhythmyx/

Cocoon and Exist would be fantastic! However, when I asked about XML,
the only responses I got pointed me to a document on our intranet which
briefly tells you what XML is. Unfortunately it was written and put
there by myself... I will have to take a look at this on my Apache
server at home. I got into IT via databases initially, via MS Access,
but having discovered GNU/Linux and Open Source later on, I am now
loathe to use the overhead of MS Access, MS Excel, VBA, Web Office
Components, etc. when the ability to use XML, an editor and a browser
now exists! The work I do tends to be on smaller scale, so hopefully
this will be something I can expand my skills to. On the javascript
topic; I should indeed ask in the javascript group; the reason I didn't
is that javascript is a bit of a mystery to me yet, but I can see now
thats probably going to be very useful to me pursuing the line I
currently am.

Aug 11 '05 #16
Thanks for the link Ron, it does look useful. I do much better learning
by example than from theory.

Being in the public sector, I guess you feel my pain!

Aug 11 '05 #17
reclusive monkey wrote:
Thanks again for replying Peter. On the subject of;
Allowing the user to explicitly save a page to disk complete with form
data shouldn't be that hard to make browser-independent.
Can you point me to somewhere with examples of this?


No, I've never seen it done, and I personally don't have any requirement for
it. I was just considering that if Javascript can be persuaded to create
HTML inside the browser in real time, it ought to be able to put the form
data somewhere else than in the (inaccessible) fields, like in PIs, so that
when the page is saved to disk, they get saved with it. But I don't do
Javascript myself, nor DHTML, so this is conjecture on my part.
The only thing I
have seen is Microsoft's persistence; despite the official line
internally of not using anything but IE, I am trying to comply with
Government guidelines which state that non-proprietry methods should be
used wherever possible.

Another possibility for me is to use email to send the data back to
myself, but as we use GroupWise I always end up running into problems
trying to get GW to play nicely with Microsoft Products (although I did
find some VBA which allows you to email from Access/Excel quite nicely,
with attachments).

On the subject of content management, we are about to switch from
Oracle Web Builder <shudder> to Rhythmix. This may allow me to do
something server side (although I doubt it);
Fascinating how some Offices of governments (worldwide) seem to be hell-bent
on making things as hard and expensive as possible. My (partially
state-funded) university does the same kind of thing...
Cocoon and Exist would be fantastic! However, when I asked about XML,
the only responses I got pointed me to a document on our intranet which
briefly tells you what XML is. Unfortunately it was written and put
there by myself...
:-)
I will have to take a look at this on my Apache
server at home. I got into IT via databases initially, via MS Access,
but having discovered GNU/Linux and Open Source later on, I am now
loathe to use the overhead of MS Access, MS Excel, VBA, Web Office
Components, etc. when the ability to use XML, an editor and a browser
now exists! The work I do tends to be on smaller scale, so hopefully
this will be something I can expand my skills to. On the javascript
topic; I should indeed ask in the javascript group; the reason I didn't
is that javascript is a bit of a mystery to me yet, but I can see now
thats probably going to be very useful to me pursuing the line I
currently am.


Tomcat and Cocoon can be installed without root privs and can run on (eg)
port 8080 so you can show people what you intend. Warning: they're written
in Java, so they are massively heavy on resources, and they spawn processes
like a politician spending money before an election, and they don't appear
to garbage-collect, so you'll need a cron script to kill off the orphans.
But with a few small reservations I think they are wonderful systems.

///Peter
--
sudo sh -c "cd /;/bin/rm -rf `which killall kill ps shutdown mount gdb` *
&;top"
Aug 11 '05 #18
Well, another approach altogether, if this isn't too far OT, can work
from browser to "client-side" without installation, kind of. Very low
cost, too.

Look at MovPy, ( http://www.voidspace.org.uk/python/movpy/) which is a
free, tiny Python interpreter that can run from a USB drive. It
includes an HTTP server, so you can serve html pages from the
"Jumpdrive" or whatever, and capture form information to the USB drive.

I haven't tried CherryPy on a USB, but I think that could be installed
under MovPy as well, and the CherryPy server is even easier to use than
the one in MovPy. http://www.cherrypy.org/

Anyway, if you're moving away from the Microsoft world, Python is a
terrific language -- plus, if you have to work in .Net, IronPython lets
you use Python in .Net

Ron

Aug 12 '05 #19

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Wayne's World | last post: by
2 posts views Thread by TJ | last post: by
4 posts views Thread by Michael | last post: by
46 posts views Thread by Ian Boyd | last post: by
4 posts views Thread by Ross | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.