I want to convert an HTML file into an XML document using php. I've googled and been through some of stackoverflow's questions, but couldn't find any solution.
This is my html code and i want to convert it into XML doc.
<html>
<body>
<ul>
<li>Section 1</li>
<li>Section 2
<ul>
<li>Section 2.1</li>
<li>Section 2.2</li>
</ul>
</li>
<li>Section 3</li>
</ul>
</body>
</html>
and i want it into
<root>
<part>
<number>Section 1</number>
<number>Section 2</number>
<child_number>Section 2.1</child_number>
<child_number>Section 2.2</child_number>
<number>Section 3</number>
</part>
</root>
if there is any technique for converting this html file into XML using php, then please help me. Any help would be thankful.
It looks like someone was able to do something similar to what you are looking for using tidy. Converting HTML to XML. If this is not an option then you may be left to writing a set of code that can handle your html files and export them to xml.