Jump to content

simplexml api problem


arman2123
 Share

Recommended Posts

HiSuppose i have an xml file portal.xml like this <?xml version="1.0" encoding="UTF-8" standalone="yes"?><portal><info><name>arman</name><job>boss</job></info><info><name>mamun</name><job>chela</job></info></portal>now i have another xml with the same structure named temp.xml<?xml version="1.0" encoding="UTF-8" standalone="yes"?><portal><info><name>php</name><job>scripting</job></info></portal>If i want to add this info node from temp.xml to portal.xml using simplexmlfunctions what should be the best/easiest method.Right now i read all the data , create all nodes , textnodes and then append them.This is very slow.Can i do anything similar to this ( conceptually similar )<?php $xml = simplexml_load_file ("portal.xml"); $tmp = simplexml_load_file ("temp.xml"); $portal1 = $xml->portal; $portal2 = $tmp->portal; $info = $portal2->info[0]; $portal1->appendChild($info); ?>please help if u can Thanx :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...