# How do I convert HTML code to XML friendly data?

**URL:** https://forum.kirupa.com/t/how-do-i-convert-html-code-to-xml-friendly-data/325421
**Category:** web dev
**Created:** [October 14, 2011, 6:28am UTC](https://forum.kirupa.com/t/how-do-i-convert-html-code-to-xml-friendly-data/325421 "2011-10-14T06:28:14Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![cocoqw123](https://avatars.discourse-cdn.com/v4/letter/c/5daacb/32.png) [@cocoqw123](https://forum.kirupa.com/u/cocoqw123)
#### Post date: [October 14, 2011, 6:28am UTC](https://forum.kirupa.com/t/how-do-i-convert-html-code-to-xml-friendly-data/325421/1 "2011-10-14T06:28:14Z")

</div>

I have a PHP page that parses data from an XML file and places it in my landing page. Obviously XML prohibits the use of “\<” and “\>”. So my question is, are there any utilities or tools that could automate the conversion of HTML code to XML friendly data.

Example:  
convert: \<img src=“picture.jpg”\>  
to: &[html entity code for \<];img src=“picture.jpg”&[html entity code for \>];
