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

Veeven

Usenet Archive
Joined
Jan 11, 2004
Messages
1
Reaction score
0
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.
 

Martin Honnen

Usenet Archive
Joined
Apr 8, 2000
Messages
6,174
Reaction score
0
Veeven said:
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.
 
G

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/>

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

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
548,208
Messages
3,104,799
Members
249,594
Latest member
henrywalsh

Latest Threads

Top