Hello there, I'm new to all this newsgroup stuff, so please tell me if I'm putting this in the wrong place.

I am having some problems with the XML features (I use the fancy new SimpleXML). It works like a dream when I'm retrieving information from an XML document, but when I want to insert new tags it screws up. I'm trying to create a function that saves error logs in an XML file, which should look like this:

        <?xml version='1.0' standalone='yes'?>
        <errors>
                <error>
                        <number>2</number>
                        <string>Could not bla bla</string>
                        <file>filename.php</file>
                        <line>56</line>
                </error>
                <error>
                        <number>1</number>
                        <string>Failed to bla bla</string>
                        <file>filename2.php</file>
                        <line>123</line>
                </error>
        </errors>

Well, You get the picture... The thing is, I don't know how to add another <error> tag. I've tried to use simplexml_load_file() to open the error log file, then using $xml->error[] = "<number>..." or $xml->error[] = new ObjectWithSomeProperties, I've even tried to load a string containing the tags (number, string etc.) into simplexml_load_string, then inserting it with $xml->error[] = $newobject, but none of these works, which leads me to believe that I can't use the [] thing to make a new <error> tag. But how do I do it then?


Best regards, Daniel

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to