我什么时候需要使用 "在 xml 中? [英] When do I need to use the " in xml?

查看:34
本文介绍了我什么时候需要使用 "在 xml 中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我的引号不在属性中时,是否需要使用 " 对它们进行编码?

When I have quotes that are not in an attribute do I need to encode them using "?

哪个是正确的?图A还是图B?

Which is correct? Exhibit A or Exhibit B?

<boat>
    <name> Bertha </name>
    <description> Good boat.  10 feet long.  "Fixer-upper"</description>
</boat>

图表 B

<boat>
    <name> Bertha </name>
    <description> Good boat.  10 feet long.  &quot;Fixer-upper&quot;</description>
</boat>

推荐答案

你的两个例子都是有效的.

Both of your examples are valid.

你只需要&quot;在一个属性值中;" 字符会提前关闭属性.

You only need &quot; inside an attribute value; a " character would close the attribute early.

这篇关于我什么时候需要使用 &amp;quot;在 xml 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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