Jim wrote:
> I've tried using JScript and VBScript but I cant get it to work, I'm not
> realy bothered what technology I use just as long as it works.
>
> Heres how the XML looks
>
> <data>
> <record>
> <email></email>
> <feedback>some feedback</feedback>
> </record>
> </data>
The following script does the job (copies all except the last
line of the file to a temporary file, appends the new elements,
adds back the data end-tag, and copies it all back to the
original file). If you want it to run as CGI, you'll need to
add the Content-Type and response HTML in the usual way and
address it as
http://your.server.com/cgi-bin/uncgi/whatever
(assuming you've installed uncgi and your form has fields
called email and feedback).
It ain't pretty, but if you don't need a fully-parsed XML
solution, it'll work. If you're stuck with Windows, though,
you have my deepest sympathies. Maybe use Cygwin?
--------------------------<snip>------------------------------
#! /bin/sh
# Bourne shell script to add email address and comment
# to an XML file guestbook
# Dependencies: uncgi
# (
http://www.midwinter.com/~koreth/uncgi.html)
# The guestbook directory and file index.xml must be
# owned by the web server process (eg apache)
DIR=/var/www/html/guestbook
FILE=index.xml
TEMP=/tmp/index.xml
################################################## ####
cd $DIR
LINES=`cat $FILE | wc -l`
LINES=$[LINES-1]
head -$LINES $FILE >$TEMP
echo \<record\> >>$TEMP
echo \<email\>$WWW_email\</email\> >>$TEMP
echo \<feedback\>$WWW_feedback\</feedback\> >>$TEMP
echo \</record\> >>$TEMP
echo \</data\> >>$TEMP
cp $TEMP $FILE
exit 0
------------------------<snip>-------------------------
///Peter
--
XML FAQ:
http://xml.silmaril.ie/