Jump to content

Convert XHTML to XML


kimtd

Recommended Posts

Hi everyone. I'm in the process of writing a script to convert HTML to XML.

I read somewhere that TIDY is a good way of doing it... so I

 

1) convert HTML like this to XHTML like this using TIDY

 

2) then I convet to XML using simple_xml_load() function in PHP

 

This works well.. except "href" attribute in "<a href>" gets lost and all the relevant link information is gone.

 

Basic PHP script:

 


var_dump(simplexml_load_file($filename));

 

Can anyone help with this?

Link to comment
https://forums.phpfreaks.com/topic/96955-convert-xhtml-to-xml/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.