- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在尝试读取此 xml: xml rss file
但没有成功..有这个错误
Warning: simplexml_load_file(): http://noticias.perfil.com/feed/:232: parser error : CData section not finished <p>La sola lectura de los datos estadísticos desp in D:\xampp\FerreWoo\scrap-rvnot.php on line 43
Warning: simplexml_load_file(): Isis, con lo que habría logrado un nuevo respaldo a sus proyectos terroristas. in D:\xampp\FerreWoo\scrap-rvnot.php on line 43
Warning: simplexml_load_file(): ^ in D:\xampp\FerreWoo\scrap-rvnot.php on line 43
我正在使用这段代码:
$feed = simplexml_load_file($urls, null, LIBXML_NOCDATA);
我也尝试了 cURL,但同样的错误仍然存在。
我知道可能 de xml 文件不正确...但必须有一种方法来读取它,对吧?
最佳答案
您在该 XML 中包含一些无效字符。试试下面的代码
$url = 'http://noticias.perfil.com/feed/';
$html = file_get_contents($url);
$invalid_characters = '/[^\x9\xa\x20-\xD7FF\xE000-\xFFFD]/';
$html = preg_replace($invalid_characters, '', $html);
$xml = simplexml_load_string($html);
//test purpose part
$encode = json_encode($xml);
$decode = json_decode($encode, true);
print_r($decode);
希望对你有帮助
关于php - 如何读取此 xml,获取 "parser error : CData section not finished",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44250530/
这个问题在这里已经有了答案: What does in XML mean? (13 个答案) 关闭 8 年前。 我不熟悉 XML 及其相关技术。 这个 CDATA 标签总是在开头,然后是一些东西
我遇到了这种困难的情况,我需要在另一个 CDATA 标签中使用 CDATA 标签。不过,这种情况很容易解释。 我有以下东西: ]]> 出于显示目的,我也需要将我的 Javascript 包装
我是 Blogger 博客用户。我曾经看到一个在 CDATA 标记内定位脚本的模板,如下所示: /**/ 虽然,我之前看到过类似的代码,如下所示: // 唯一不同的是/*
我很确定节可以在 XHTML5 中使用,但是 HTML5 呢? 最佳答案 CDATA structure 根本不是针对 HTML 的,它是针对 XML 的。 人们有时会在 XHTML 里面使用它们 s
我正在尝试删除字符串中的所有 [.*],但不删除 ![CDATA[xxx]]。我期待以下结果 """![CDATA[please remove[macro]]]""" .replaceAll(
不允许在 内堵塞。这是可以理解的。 现在,我必须在 中传输用户输入的数据堵塞。恶意用户可能会输入 或两者兼而有之。 问题是:处理这种情况的首选方法是什么? 剥离 ? 用空格替换它? 用错误消息打
我有一个定义元素“密码”的 XSD。我想允许任何角色存在。目前,我将元素定义为 xs:string用户必须转义字符串(例如 myP&ssword )或将其包含在 CDATA 标记中(例如 )
我在解析 XML 时遇到以下异常 org.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM]
我正在尝试使用 powershell 读取 rss 提要,但无法在提要中提取 cdata 部分 这是提要的片段(为了节省空间,剪掉了一些项目): ... text 2011-11-28T
XML文档中的所有文本均会被解析器解析 只有CDATA 区段中的文本会被解析器忽略 PCDATA - 被解析的字符数据 XML解析器通常会解析 XML 文档中所有的文本 当某个XML 元素被解
我需要使用 Javascript 清除该文本 block 的部分内容: Lorem Ipsum is simply dummy text of the printing and typesetting
我看到了 solution让 XmlSerializer 输出 CDATA 部分,但是是否可以根据另一个值有条件地实现这一点? 下面的代码演示了我想要的结果: enum LogItemType {
我正在 Angular 应用程序中进行 soap 调用。 我需要为其中一个调用的有效载荷部分传递 CDDATA angular.forEach(contactsCollection, function
请帮帮我 在终端中: C no longer supported in regex; marked by / 我的文件 perl 中的代码 if ($html =~ //) 解决这个问题的最佳方法是什
我得到一个包含 CDATA 的字符串,我想删除它。 Input : "" Output I want : Hello World 我想获取 之间的所有数据和 并将其添加到
最近,我正在创建一个模块来将谷歌再营销标签添加到网上商店。根据文档,我已经为不同类型的页面(产品、类别、购物车等)准备了 google_tag_params。一切顺利,直到客户使用 Chrome 的
我试图在描述字段中创建 CDATA 部分,但失败了。代码非常简单,但在生成的 XML 中没有出现 CDATA 部分!! Node de = document.createElement("descri
这个问题是由开发人员 Michael Rys 相当激进地拒绝将 CDATA 部分的解析包含到 FOR XML PATH 中引起的,因为 "There is no semantic difference
您好,我这里有一个 CDATA 示例 和 我的 CDATA 正则表达式无法识别这个 "])*"]]>" 这也行不通 "][^\]]*[\]]{2,})*">" 有人可以给我一个 的正则表达式吗?
我经常使用内联 Javascript,通常是在我制作的 WordPress 主题中。我没有听说过在 // 中包装内联 Javascript直到几个月前,几年来我一直在以相当的能力水平做这件事。 我四处
我是一名优秀的程序员,十分优秀!