从php-htmlspecialchars()添加大于XML& gt的dom创建XML;
我正在从php创建XML文件,我无法添加到Bold Line $类别 - > nodeValue ='foot>普通脚'符号大于大于。如果我查看文件,则有> 我尝试过HTMLSpececialChars和NodeTextValue,但没有正确冻结。 非常感谢您的帮助。我有UTF-8编码 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');
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');
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论