Write to XML file client side

Discussion in 'XML' started by reclusive monkey, Jun 28, 2005.

  1. 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!
    reclusive monkey, Jun 28, 2005
    #1
    1. Advertising

  2. 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/
    Martin Honnen, Jun 28, 2005
    #2
    1. Advertising

  3. 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.
    reclusive monkey, Jun 28, 2005
    #3
  4. 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/
    Martin Honnen, Jun 28, 2005
    #4
  5. > 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!
    reclusive monkey, Jun 28, 2005
    #5
  6. 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
    Gerald Aichholzer, Jun 28, 2005
    #6
  7. reclusive monkey

    Peter Flynn Guest

    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"
    Peter Flynn, Jul 3, 2005
    #7
  8. > 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.
    reclusive monkey, Jul 4, 2005
    #8
  9. reclusive monkey

    HALLES Guest

    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.
    HALLES, Jul 9, 2005
    #9
  10. 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.
    reclusive monkey, Jul 10, 2005
    #10
  11. reclusive monkey

    HALLES Guest

    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.
    HALLES, Jul 13, 2005
    #11
  12. reclusive monkey

    Bobby Guest

    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.

    *** Sent via Developersdex http://www.developersdex.com ***
    Bobby, Jul 18, 2005
    #12
  13. Thanks for the post Bobby, I will have another look on msdn.
    reclusive monkey, Jul 19, 2005
    #13
  14. reclusive monkey, Jul 19, 2005
    #14
  15. reclusive monkey

    Kooben Guest

    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


    *** Sent via Developersdex http://www.developersdex.com ***
    Kooben, Jul 20, 2005
    #15
  16. 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.
    reclusive monkey, Jul 22, 2005
    #16
  17. reclusive monkey

    Peter Flynn Guest

    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"
    Peter Flynn, Aug 10, 2005
    #17
  18. 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.
    reclusive monkey, Aug 10, 2005
    #18
  19. reclusive monkey

    Peter Flynn Guest

    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/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
    --
    sudo sh -c "cd /;/bin/rm -rf `which killall kill ps shutdown mount gdb` *
    &;top"
    Peter Flynn, Aug 10, 2005
    #19
  20. reclusive monkey

    paron Guest

    paron, Aug 11, 2005
    #20
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. moondaddy
    Replies:
    2
    Views:
    1,021
    Steven Cheng[MSFT]
    Jul 16, 2004
  2. =?Utf-8?B?YWRvbGYgZ2FybGlj?=

    How to access client side XML data island from server side?

    =?Utf-8?B?YWRvbGYgZ2FybGlj?=, Nov 23, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,155
    aa7im
    Nov 23, 2004
  3. Boss302
    Replies:
    0
    Views:
    1,028
    Boss302
    Nov 21, 2006
  4. Bogdan
    Replies:
    2
    Views:
    639
    Bogdan
    Jun 9, 2008
  5. Zoe Hart
    Replies:
    1
    Views:
    355
    Scott Wisniewski
    Jan 8, 2004
Loading...

Share This Page