DOM create xml from php- htmlspecialchars() Troubles with adding greater than to xml >

63 views Asked by At

I am creating xml file from php and I am not able to add to bold line $category->nodeValue='Foot>Ordinary foot' symbol greater than. If I view file there is > I have tried htmlspecialchars and nodeTextValue but nothing woks correctly. Thanks a lot for help. I have UTF-8 coding V

    $dom = new DomDocument();
$dom->encoding = "UTF-8";
$dom->formatOutput = true;

$root = $dom->createElement('itemlist');
$dom->appendChild($root);

$dataPackItem = $dom->createElement('item');
$root->appendChild($dataPackItem);

$product_category = $dom->createElement('product_category');
$dataPackItem->appendChild($product_category);  

$category = $dom->createElement('category');
$category->setAttribute('id', '63');    
**$category->nodeValue='Foot>Ordinary foot';**

$product_category->appendChild($category);      


echo '<xmp>'. $dom->saveXML() .'</xmp>';
$dom->save('images/export_sz_opencart.xml') or die('XML Create Error');
0

There are 0 answers