Write to XML file client side

R

reclusive monkey

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!
 
R

reclusive monkey

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/developers/ado_persist_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.
 
M

Martin Honnen

reclusive said:
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"
 
R

reclusive monkey

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!
 
G

Gerald Aichholzer

reclusive said:
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
 
P

Peter Flynn

reclusive said:
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
 
R

reclusive monkey

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.
 
H

HALLES

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.
 
R

reclusive monkey

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.
 
H

HALLES

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.
 
B

Bobby

Yes its definately possible to do it;

There is a sample demo on microsofts website NOT using data islands.

No, I do not have a link; Yes I have done it before.

Completely 100% clientside. The security stuff everyone is mentioning
(about being able to write to your HD from a web browser) came about 2
months after they released the demo. They added a hack that prohibited
writing to HD, but you could enable that behavior via the browser
preferences. It may be related to *.hta, as that was something I was
looking into at the time.

Good luck, and post a response if you find it.
 
K

Kooben

Hi

An interesting thread , the above solution only supports IE browser
doesnt it?

Any ideas of how the same writing to XML files could be done on other
browsers?

Also did you manage to edit XML files with the above method then?

Cheers
 
R

reclusive monkey

Yes its true it does only support IE. As this is the only browser we
use (there was a recent anouncement that there was no business case to
change browsers), and this is only an internal project this isn't a
problem.

I've not had time to play with editing the XML, but the examples I have
downloaded from MSDN seem to work fine. As I said this is all new to
me, but now I know at least that what I want to acheive is possible.

An apology to Martin Honnen is warranted to; he originally showed me
the link I found again, reading it in isolation didn't shed much light
on my small brain. It was only after searching around for a few hours
and reading the supporting links that it made sense. From my original
request, I can think of several other applications I am going to be
able to put this to use for now. I will make sure I post my results
when I have them.
 
P

Peter Flynn

reclusive said:
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
 
R

reclusive monkey

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/samples/author/persistence/saveSnapshot_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.
 
P

Peter Flynn

reclusive said:
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/samples/author/persistence/saveSnapshot_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
 

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,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top