【发布时间】:2012-02-18 10:09:22
【问题描述】:
我有两个用于获取应用程序描述的 api 和一个通用 UI。我需要检查 Java 中的描述是否带有CDATA 标签。
例如,一个应用具有以下描述:
"<![CDATA[<p>What is Skype?<br />Skype is software that enables the world's
conversations. Millions of individuals and businesses use Skype to make free video and voice
calls, send instant messages and share files with other Skype users. Everyday, people also
use Skype to make low-cost calls to landlines and mobiles.</p>]]>"
另外一个应用有如下描述
Run with your fingers as fast as you can to try and get to the top of the leader board. This
game gets even better with friends, Once people see you playing they will want to have a go
and try to beat your fastest time. Tip: Take long strides on the screen to get maximum
distance per step,
<a href=https://abc.defgh.ij.kl/apps/wap/shopping/shopping/freshima-supermarket/freshima-supermarket/web/>WAP URL</a>
如何区分这两种描述?有没有办法在Java中检测描述是否带有CDATA?
【问题讨论】:
-
为什么重要?它要么使用 CDATA,要么使用实体(或者在需要任何一个的地方都没有字符)。无论您使用什么 XML 库,都应该透明地处理它。