Even though the CDATA section is removed, the whitespace is properly preserved.
虽然去掉了cdata节,但空白正确地保留了下来。
What can you do if you need to put a section end marker into a CDATA section?
如果您需要将区域结束标记放到CDATA区域中,那么该怎么办呢?
You can't take just any data and dump it into a CDATA section and still have a valid document.
您不能将任何数据随意地塞到一个CDATA区域中同时还拥有一个有效的文档。
Each CDATA section, comment, processing instruction, and non-leaf node is assigned a binary codeword.
每个CDATA部分、注释、处理指令和非叶节点都被分配一个二进制代码字。
Cdata-section-elements - a comma-separated list of elements that should be serialized as cdata sections.
cdata - section - elements——以逗号分隔的元素列表,这些元素应被序列化为cdata节。
The hack uses a combination of the <xsl:text> element and a CDATA section to force the XSLT processor to accept the split
这种拆分方法使用 <xsl:text>元素和CDATA节的组合来强迫XSLT处理器接受拆分
Clearly the CDATA section is useful, but like all good things, it has a couple of limitations for you to keep in mind.
显然,CDATA区域很有用;但与其他所有好东西一样,它也有几个应该牢记的限制。
A better solution might be to put the data directly into your XML document. That's where XML's CDATA section comes into play.
更好的解决方案可能是将数据直接放到您的XML文档中,那就是XML的CDATA区域发挥作用的时候了。
In fact, that's the reason why you should wrap an embedded script in a CDATA section instead of an XML comment-comments are too fragile.
事实上,那就是为什么应该将嵌入式脚本封装到CDATA区域而不是xml注释中的原因—注释太脆弱了。
One solution is to prepare a CDATA section, as in Listing 3, for the code block and just paste into that so that you don't need further escaping.
一种解决方案是使用CDATA部分,如清单3 所示,将代码直接粘贴到这个代码块,这样就不需要进行进一步的转义了。
Note: Since the URL might contain special characters, we have embedded it inside a CDATA section to prevent the request XML from becoming malformed.
注意:因为URL可能包含特殊字符,所以我们把它嵌入在CDATA部分中,以避免请求XML变得怪异。
If the XML parser reads this sequence, it's the end of your CDATA section and you might end up getting a parser error when it hits the real section end.
如果xml解析器读到这个序列,就认为您的CDATA区域结束,当解析器遇到真正的区域结尾时,可能会发出一条解析错误消息。
Since the statement in the STMTKEY element contains the special XML characters , the query text needs to be enclosed in a CDATA section starting with
由于 STMTKEY元素中的语句包含特殊的XML字符 ,因此需要用一个CDATA 部分将查询文本包围起来,CDATA 的开始部分为
Wrapping the sample markup in a CDATA section lets you write it as-is, without having the XML parser attempt to interpret it as a element containing an element.
将这个样例标记包含在一个CDATA 区域中允许您原样编写标记,无需XML解析器试图将其解释为一个包含元素的 元素。
If the data happens to be text, you can dump it into a CDATA section and be done with it, but true binary data needs to be encoded in a safe and recoverable manner.
如果这些数据碰巧是文本,您只需将它们放到CDATA区域中,但真正的二进制数据需要以一种安全且可恢复的方式编码。
You'll either lose their contents (the CDATA section has vanished from the normal DOM) or have the contents rendered as text with some stray markup characters showing up.
它们的内容要么丢失(CDATA区域从正常的DOM中消失),要么显示为文本,并带有一些游离的标记字符。
The Details element contains a brief HTML description of the detector, and should therefore be contained in a CDATA section. This description is used by the UI, as shown in Figure 2
Details元素包含检测器的简单HTML描述,因而应当包含在CDATA部分中。
Even though the contents of the CDATA section pass through your parser untouched, they still need to be valid XML data characters, as specified by the document's character encoding.
即使CDATA区域的内容完好无损地通过您的解析器,它们仍需是有效的XML数据字符,正如文档的字符编码所规定的一样。
I will revisit CDATA sections in the third article in this series, but for now, suffice it to say that they are less safe than escaping because one CDATA section cannot include another CDATA section.
本系列的第三篇文章中,我还将讨论cdata节,现在只要知道它们比转义更安全就足够了,因为cdata节不能包含另一个cdata节。
I will revisit CDATA sections in the third article in this series, but for now, suffice it to say that they are less safe than escaping because one CDATA section cannot include another CDATA section.
本系列的第三篇文章中,我还将讨论cdata节,现在只要知道它们比转义更安全就足够了,因为cdata节不能包含另一个cdata节。
应用推荐