SimpleXML adding html into Hash tree
- by Miriam Raphael Roberts
Question: I have an xml file that I am pulling from the web and parsing. One of the items in the xml is a 'content' value that has HTML. I am using SimpleXML/XMLin to parse the file like so:
$xml= eval { $data-XMLin($xmldata, forcearray = 1, suppressempty= +'') };
When I use Dumper to dump the hash, I dsicovered that SimpleXML is parsing the HTML into the hash tree.
'content' => {
'div' => [
{
'xmlns' => 'http://www.w3.org/1999/xhtml',
'p' => [
{
'a' => [
{
'href' => 'http://miamiherald.typepad.com/.a/6a00d83451b26169e20133ec6f4491970b-pi',
'style' => 'FLOAT: left',
'img' => [
etc.....
This is not what I want. I want to just grab content inside of this entry. How do I do this?