This question already has an answer here:
- How do you parse and process HTML/XML in PHP? 30 answers
- Basic simpleXML working example? 5 answers
assume I have simple xml like this one, and I want to read it in way that I will get the element in xml format.
<?xml version="1.0" encoding="UTF-8"?>
<contentdata>
<Games>
<numberof>2</numberof>
<nameof>
<n1>Game1</n1>
<n2>Game2</n2>
</nameof>
</Games>
<Software>
<numberof>1</numberof>
<nameof>
<n1>Software1</n1>
</nameof>
</Software>
</contentdata>
That means the output after reading should be like below :- Kindly, assist in any way you can, I will appreciate that. Thank you.
<Games>
<numberof>2</numberof>
<nameof>
<n1>Game1</n1>
<n2>Game2</n2>
</nameof>
</Games>
</div>