从php-htmlspecialchars()添加大于XML& gt的dom创建XML;

发布于 2025-02-08 13:24:36 字数 885 浏览 1 评论 0原文

我正在从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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文