How do I append and modify an XML file on-line?

Discussion in 'XML' started by Veeven, Jan 11, 2004.

  1. Veeven

    Veeven Guest

    Hi,

    Suppose I have an XML file like this on the web, say,
    http://www.example.com/list.xml

    <?xml version='1.0'?>
    <list>
    <item id='itm01'>
    <name>Item 1</name>
    <desc>This is item 1</desc>
    </item>
    <item id='itm02'>
    <name>Item 2</name>
    <desc>This is item 2</desc>
    </item>
    <!-- many more... -->
    </list>

    I want to add a new item to the list or modify an existing item. Is
    there any way (like I fill out a form and list.xml is updated) either
    using ASP, PHP or Perl?

    Please help. Thanking you.
    Veeven, Jan 11, 2004
    #1
    1. Advertising

  2. Veeven wrote:

    > Suppose I have an XML file like this on the web, say,
    > http://www.example.com/list.xml
    >
    > <?xml version='1.0'?>
    > <list>
    > <item id='itm01'>
    > <name>Item 1</name>
    > <desc>This is item 1</desc>
    > </item>
    > <item id='itm02'>
    > <name>Item 2</name>
    > <desc>This is item 2</desc>
    > </item>
    > <!-- many more... -->
    > </list>
    >
    > I want to add a new item to the list or modify an existing item. Is
    > there any way (like I fill out a form and list.xml is updated) either
    > using ASP, PHP or Perl?


    Well, current browser support HTML 4 which has form controls like <input
    type="text"> which will allow you to build a form where someone can
    enter the name and desc of a new item and submit the data to a server
    where a PHP or ASP or Perl script could then add the item to your XML file.
    Browsers like IE5+/Win and Netscape 6+ respectively Mozilla also have
    script support to build XML documents in memory using the W3C DOM and
    post such an XML document serialized to a server, ASP can easily read
    such a posted XML, PHP is in my experience not that good at reading a
    posted file (although I think since 4.3.0 it is better supported), with
    Perl CGI scripting I am not too familiar to judge its facilities here.

    HTML forms have no support for binding/posting XML directly, there are
    two suggestions for new forms that support that, one is XForms from the
    W3C, see
    http://www.w3.org/MarkUp/Forms/
    which has some implementations, and the other is Web Forms, see
    http://www.hixie.ch/specs/html/forms/web-forms
    which is as far as I know not implemented anywhere (being just a draft)
    but written by an Opera employee so it seems it has chances to be
    implemented some day.
    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Jan 11, 2004
    #2
    1. Advertising

  3. Veeven

    Guest Guest

    You can do it by using XMLHTTP post from JSCript on cleitn side and tiny
    engine written, say, on ASP for server side which will just accept incoming
    data post and store it back into your xml data file. There is the way to use
    XMLDSO, but can't say is it works for saving data back on server, probably
    should, but never tryed it actually.

    Cheers,
    <spider/>

    "Veeven" <> wrote in message
    news:...
    : Hi,
    :
    : Suppose I have an XML file like this on the web, say,
    : http://www.example.com/list.xml
    :
    : <?xml version='1.0'?>
    : <list>
    : <item id='itm01'>
    : <name>Item 1</name>
    : <desc>This is item 1</desc>
    : </item>
    : <item id='itm02'>
    : <name>Item 2</name>
    : <desc>This is item 2</desc>
    : </item>
    : <!-- many more... -->
    : </list>
    :
    : I want to add a new item to the list or modify an existing item. Is
    : there any way (like I fill out a form and list.xml is updated) either
    : using ASP, PHP or Perl?
    :
    : Please help. Thanking you.
    Guest, Jan 12, 2004
    #3
    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. Hugo
    Replies:
    10
    Views:
    1,289
    Matt Humphrey
    Oct 18, 2004
  2. kaushikshome
    Replies:
    4
    Views:
    752
    kaushikshome
    Sep 10, 2006
  3. HYRY
    Replies:
    10
    Views:
    582
    Bruno Desthuilliers
    Sep 26, 2007
  4. scad
    Replies:
    23
    Views:
    1,139
    Alf P. Steinbach
    May 17, 2009
  5. PerlFAQ Server
    Replies:
    0
    Views:
    369
    PerlFAQ Server
    Feb 24, 2011
Loading...

Share This Page