XML解析错误::88:805:格式不正确(无效令牌)

问题描述:

我收到错误消息:XML解析错误:88:805:格式不正确(无效标记)当我尝试使用https://validator.w3.org/XML解析错误:<unknown>:88:805:格式不正确(无效令牌)

我无法找到相同的原因。下面

<content:encoded><![CDATA[<p>It&rsquo;s a pleasure to share some of the recipes in <a href="https://www.example.com/abc-dss-Life-as-Radiant-Boundless/dp/0814437079/ref=sr_1_1?ie=UTF8&amp;qid=1467207110&amp;sr=8-1&amp;keywords=a+plant+based+life"><em>A ad-as</em></a>with you! I finished perfecting this recipe the week that NASA&rsquo;s Kepler Mission found a new Earth-like planet, 452b, so I named it in honor of the discovery. If I were an astronaut on a years-long space mission and could only bring one food with me, this lasagna would definitely be a top contender. Other great features of this recipe? Neither the noodles nor the filling need to be precooked&mdash;after some quick chopping, which you can do in a food processor, this dish will be ready to pop in the oven.For the full sampler of recipes with delicious images, <a href="http://www.example.net/abc/a-abc-abc-abc-abc" target="_blank">click here to see the slideshow</a>. <strong>Ingredients: </strong></p> 

是给出其被标记为有缺陷的 代码错误说,不能很好地形成的XML。

要修复它,做如下修改:

  1. 定义使用content命名空间前缀。
  2. 删除^K字符。
  3. 关闭CDATA部分。
  4. 关闭content:encoded元素。

这是你的XML应用了以下修复:

<content:encoded xmlns:content="http://example.com/content"> 
    <![CDATA[<p>It&rsquo;s a pleasure to share some of the recipes in <a 
    href="https://www.example.com/abc-dss-Life-as-Radiant-Boundless/dp/0814437079/ref=sr_1_1?ie=UTF8&amp;qid=1467207110&amp;sr=8-1&amp;keywords=a+plant+based+life"> 
    <em>A ad-as</em> </a>with you! I finished perfecting this recipe the 
    week that NASA&rsquo;s Kepler Mission found a new Earth-like planet, 
    452b, so I named it in honor of the discovery. If I were an 
    astronaut on a years-long space mission and could only bring one 
    food with me, this lasagna would definitely be a top 
    contender. Other great features of this recipe? Neither the noodles 
    nor the filling need to be precooked&mdash;after some quick 
    chopping, which you can do in a food processor, this dish will be 
    ready to pop in the oven.For the full sampler of recipes with 
    delicious images, <a 
    href="http://www.example.net/abc/a-abc-abc-abc-abc" 
    target="_blank">click here to see the 
    slideshow</a>. <strong>Ingredients: </strong> </p>]]> 
</content:encoded> 

它现在形成良好。

+0

虽然我的问题不同,但您建议的结构对我有很大的帮助。我的问题是CDATA节嵌入在标签中。作为URL的一部分的“ - _”的字符序列使得RSS提要无效,尽管它位于CDATA部分内。不管怎样,谢谢! – helvete