嵌套的CDATA-正确 [英] Nested CDATA - correctly

查看:295
本文介绍了嵌套的CDATA-正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在XML文档中存在问题:

That's problem in XML document:

<![CDATA[<b>Title</b> 
       Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
       tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
       quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
       consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
       cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
       proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
]]>

我需要在此文本中插入CDATA表达式。怎么做 ? (如果我这样做,我会在评估文件时看到错误)

I need to insert thу CDATA expression in this text. How to do it ? (I see the error while evaluationg document if I do like this)

<![CDATA[]]]]>Expression<![CDATA[>]]>


推荐答案

@Oded在上面的评论中张贴了参考真实答案...我想将其添加为答案,以便人们可以找到它。

如果他/她添加了它,我们可以删除它。

@Oded posted a reference real answer above in a comment... I want to add it as an answer so people can find it.
If he/she adds it we can delete this one.

是的,请务必确保需要执行此操作; CDATA通常首先被滥用,更不用说嵌套了。
但是在某些时髦的场合我们会这样做。

Yes, it is important to be really sure you need to do this; "CDATA" is often misused in the first place, let alone nested. But in some funky occasions we do.

基本计划是掩埋另一个CDATA中嵌套CDATA的末尾。
将剥夺对外部CDATA的解释而离开内部。

The basic plan is to bury the end of the nested CDATA in another CDATA. It will be stripped with interpretation of the outer CDATA to leave the inner.

这是@Oded上面的Wikipedia文章

en.wikipedia.org/wiki/CDATA#Nesting

This is in the wikipedia article from @Oded above
en.wikipedia.org/wiki/CDATA#Nesting

该操作是替换任何内部嵌套的

The action is to replace any inner, nested

]]>

]]]]><![CDATA[>

这篇关于嵌套的CDATA-正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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