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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to