如何用<替换xml文件的特定标签的内容?而不是& lt; ? [英] How to replace a perticular tag's content of an xml file with < instead of < ?

查看:401
本文介绍了如何用<替换xml文件的特定标签的内容?而不是& lt; ?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

展开 | 选择 | Wrap | 行号

推荐答案

您的意图是正确的,因为您需要将内容放入CDATA部分。但是,CDATA部分的创建方式不同(因此,您的CDATA部分作为注释插入)。

a XML中的CDATA部分是一个自己的节点类型,因此您必须创建它显式: DOMDocument-> createCDATASection(
your intention is correct as you need to put the content in a CDATA section. however, a CDATA section is created differently (and because of that, your "CDATA section" is inserted as comment).
a CDATA section in XML is an own node type, therefore you have to create it explicitly: DOMDocument->createCDATASection(


textContent);
textContent);


非常感谢回复。我只是测试它和它然后告诉你,如果它对我有利,我会尽快回复。
Thank you very much for the reply. I just test it & then tell you that if it benefits me or not...will post reply soon for this.


这篇关于如何用<替换xml文件的特定标签的内容?而不是& lt; ?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆