简体   繁体   中英

how to check that XML element contains CDATA?

i am parsing a XML file in java. How can I know whether the emelent contains CDATA or not? In other words how to identify elements containing CDATA?Thanks

WL

You will have to read the text of the tag then find if CDATA exists within the text with a string contains or the like. Kind of like:

String cdata = data.text("xmltag");
cdata.contains("cdata")....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM