对实体“子集”的引用必须以';'结尾分隔符 [英] The reference to entity "subset" must end with the ';' delimiter

查看:281
本文介绍了对实体“子集”的引用必须以';'结尾分隔符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Blogger博客的模板中添加网页字体:

 <?xml version =1.0 encoding =UTF-8?> 
<!DOCTYPE html>
< html b:version ='2'class ='v2'expr:dir ='data:blog.languageDirection'xmlns ='http://www.w3.org/1999/xhtml'xmlns:b ='http://www.google.com/2005/gml/b'xmlns:data ='http://www.google.com/2005/gml/data'xmlns:expr ='http:// www。 google.com/2005/gml/expr'>
< head>
< link href ='http://fonts.googleapis.com/css?family = Share:400,700& subset = latin,latin-ext'rel ='stylesheet'type ='text / css'> ;
< link href ='http://fonts.googleapis.com/css?family = Istok + Web:400,700& subset = latin,latin-ext'rel ='stylesheet'type ='text / css >
< meta content ='IE = EmulateIE7'http-equiv ='X-UA-Compatible'/>
< b:else />

当我尝试保存模板时,我得到:

 解析XML的错误,第5行,第76列:对​​实体subset的引用必须以';'分隔符结尾。 

我尝试添加; 但未成功。这些链接是从Google Web Font生成的。



我应该如何解决这个问题?感谢。

解决方案

这是因为& 是XML中的保留字符这意味着一个XML实体从这里开始。 XML实体允许您打印难以嵌入文档的字符或字符序列,因为您的键盘上没有它,或者因为文档编码禁止它。例如,在(X)HTML中,& eacute; 打印字符é,这在大多数美国键盘上不容易找到。 (可用的实体依赖于XML文档的<!DOCTYPE> 声明。)



方案是,它意味着如果文档可以作为实体的开始,则不能明确地在文档周围保留文字& ,因此您需要将它们编码为实体以解决这个问题。



您需要用替换您的所有流浪& & amp; ,它将打印& 而不会激怒XML解析器。在你的情况下,你应该很好地用你的两个& amp; amp; amp; subset = 替换& subset = < link> 标签。


I am trying to include webfonts in the template of a Blogger blog:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html b:version='2' class='v2' expr:dir='data:blog.languageDirection' xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>
  <head>
    <link href='http://fonts.googleapis.com/css?family=Share:400,700&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Istok+Web:400,700&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
    <meta content='IE=EmulateIE7' http-equiv='X-UA-Compatible'/>
    <b:if cond='data:blog.isMobile'>
      <meta content='width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0' name='viewport'/>
    <b:else/>

And when I try to save the template, I get:

Error parsing XML, line 5, column 76: The reference to entity "subset" must end with the ';' delimiter.

I tried to add a ; but unsuccessfully. The links are generated and taken from Google Web Font.

How should I solve this issue? Thanks.

解决方案

That's because & is a reserved character in XML that means "an XML entity begins here". XML entities let you print characters or sequences of characters that are hard for you to embed in your document literally, either because you don't have it on your keyboard or because the document encoding forbids it. For instance, in (X)HTML, &eacute; prints the character "é", which is not easy to find on most US keyboard. (Available entities depend on the <!DOCTYPE> declaration of your XML document.)

The problem with that scheme is that it means you can't unambiguously leave literal & characters around your document if they can be the start of an entity, so you need to encode them as an entity to solve that problem.

You will need to replace all your stray & with &amp;, which will print & without angering the XML parser. In your case, you should be good with replacing &subset= by &amp;subset= in your two <link> tags.

这篇关于对实体“子集”的引用必须以';'结尾分隔符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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