Re: Generate XML files

From: Date: Thu, 15 Feb 2001 22:20:31 +0000
Subject: Re: Generate XML files
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-39994@lists.php.net to get a copy of this message
echo "<SECTION>\n<BLAH VALUE=\"$fromform_value1\">\n<FOOBAR VALUE=\"$fromform_value2\"></SECTION>"; Reformat as you want, I just didn't want to write multiple "echo" lines. =P Or.. <xml> <SECTION> <BLAH VALUE="<?php $val?>"> <FOOBAR VALUE="<?php $val2?>" </SECTION> </xml> -Szii ----- Original Message ----- From: Paulo Jan <admin@mail.ddnet.es> To: <php-general@lists.php.net> Sent: Thursday, February 15, 2001 4:05 AM Subject: [PHP] Generate XML files > Hi all: > > A question tangentially related to the former one. I have seen lots of > tutorials about how to parse XML files using PHP and generate something > else (usually HTML) from it, but I haven't seen anything so far about > generating XML with some specific data. > Basically, what I want is: > > 1) To have a XML file describing the structure of the data, like: > > <SECTION> > <BLAH VALUE=""> > <FOOBAR VALUE=""> > </SECTION> > > 2) Receive the values of "BLAH" and "FOOBAR" from, say, a Web form. > 3) Output an XML file with the values of "BLAH" and "FOOBAR", like: > > <SECTION> > <BLAH VALUE="203"> > <FOOBAR VALUE="666"> > </SECTION> > > 4) Store said XML file with the data in a text field in a database. > > I suppose that I could use the existing XML parsr functions to parse > the XML template in 1), and define event handlers that output the > relevant XML tag with the specific data, like: > > > function startElement($parser, $name, $attribs) { > $data=$data . "<BLAH VALUE=\"" . $blah . "\">"; > } > > (I know that the above is probably wrong; it's just an example). > > ...But I'd like to know if there's another way to do the above, > something more... elegant. > > > Paulo Jan. > DDnet. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#39994) next »