|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
|
|
#1
|
|||
|
|||
|
Hey there,
I am trying to develop a php file to log certain data into an xml file. The coding seems to work however the second time around the data is not saved on the xml file. Heres the code : $xml_string = "<errorlog> <report> <host>$host</host> <ipaddress>$ip</ipaddress> <errmsg>$subject</errmsg> <date>$dt</date> </report> </errorlog> "; and heres the error msg : Only one top level element is allowed in an XML document. Error processing resource 'file://wwwroot/errorlog.xml'. Line 9, Position 2 <errorlog> -^ The error i guess is because the second time around the script attempts to create the top level <errorlog> again. Is there a way to check for its presence or to avoid it from doing that ?! Appreciate your help ! Urban Dev |
|
#2
|
||||
|
||||
|
Try this (assuming that your file contains <errorlog> and </errorlog> tags already):
PHP Code:
__________________
Alex (http://www.alex-greg.com) |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > xml tree needs tweaking.... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|