Skip to content
Advertisement

XML file/data handling with PHP

I have a XML file as a master file (master.xml) and its content is blank.

JavaScript

I have a loop in which i get some data and turn them into xml files (item.xml) and their content is like

JavaScript

All i want, is to be able to get the Item from the item.xml and insert it on master.xml under the master tag so the final result would look something like

JavaScript

I don’t know if it helps but the code right now is like this.

JavaScript

The code above has a result of this

JavaScript

What am i missing?

Advertisement

Answer

You need to append the items to the first element of the $targetDom

Use:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement