My XML looks like this:
<?xml version="1.0" encoding="utf-8"?>
<SHOP>
<SHOPITEM>
<ITEM_ID>8</ITEM_ID>
<PRODUCT>Body EMMER W 12</PRODUCT>
<DESCRIPTION>
<p>Test 1
<br />Good
<br />Big
<br />Long
<br />Works
</p>
</DESCRIPTION>
</SHOPITEM>
</SHOP>
SEE: node DESCRIPTION contains HTML content, these are not another nodes.
Then in PHP I open XML file:
$xml = simplexml_load_file("file1.xml");
foreach($xml->children() as $data) {
...
}
Then I want to save some values, so:
$product = array(
"id" => (string) $data->ITEM_ID,
"item_name" => (string) $data->PRODUCT,
"description" => (string) $data->DESCRIPTION
);
But when I print these to the HTML table, description is empty. Reason is, that PHP recognize that <p> element like another node, so there will be no text/value. What should I do?