Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

noelister

macrumors 6502
Original poster
Jan 15, 2005
275
0
I am trying to create a simple Admin page to edit existing XML files and create new XML files. Currently I am using PHP and the SimpleXML parser ( is there a better parser for this). I created a script that can read and write to a specific XML file. However, I would like to be able to use this script on any XML file that pertains to my site. This is where the problem lies, not all my XML files use the same tags. Examples being, news.xml has a different format as gallery.xml. So, I need a function that could loop through the XML file to find the format and tag names (is this even possible)?

thanks for anyhelp!
N
 
Did you try this method to loop through the children nodes? SimpleXMLElement->children(). link

You can try other php xml library other than simpleXML. I have used this before and it works for simple xml structures.

Another way, I can suggest is using your Admin page with javascript to edit the xml document and then passing the entire xml string to php. Either that or with actionscript, both are very similar in their syntax.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.