Questions tagged [cdata]

CDATA (literally, character data) is data that will not be parsed as markup in XML and SGML documents.

While technically "all text that is not markup constitutes the character data" of an XML document (and a similar definition applies for SGML), the term CDATA is typically used in the context of CDATA sections.

A CDATA section begins with the string <![CDATA[ and ends with the string ]]>. The data inside a CDATA section is not parsed as markup within an XML or SGML document - which can be useful when representing XML or SGML within an XML or SGML document:

<![CDATA[
  <html>
    <head>
      <title>This is not markup ...</title>
    </head>
    <body>
      <p>... and neither is this.</p>
    </body>
  </html>
]]>

A CDATA section may contain any sequence of characters except for the string ]]> (which would terminate the section). One way to work around this limitation is to terminate the CDATA section after the string ]] and then begin a new one immediately, starting with the final >. For instance,

<![CDATA[How to represent ']]]]><![CDATA[>' inside a CDATA section.]]>

is equivalent to

How to represent ']]>' inside a CDATA section.
1111 questions
12
votes
6 answers

How to add in XML prepared by Jaxb

How to prepare XML with CDATA , I am preraring this response via Jaxb,
LMK
  • 2,882
  • 5
  • 28
  • 52
12
votes
5 answers

How can i grab CData out of BeautifulSoup

I have a website that I'm scraping that has a similar structure the following. I'd like to be able to grab the info out of the CData block. I'm using BeautifulSoup to pull other info off the page, so if the solution can work with that, it would…
hary wilke
  • 121
  • 1
  • 1
  • 3
12
votes
2 answers

Add CDATA to an xml file

I would like to add some CDATA tags around some xml tags XML source is (it's only a small part of my file)

2012 ist für viele Länder…

glmrenard
  • 675
  • 1
  • 8
  • 16
12
votes
2 answers

Using NSXMLParser with CDATA

I'm parsing an RSS feed with NSXMLParser and it's working fine for the title and other strings but one of the elements is an image thats like How do I add that as my cell image in my table view? Would I define…
Xcoder
  • 1,041
  • 5
  • 17
  • 29
11
votes
2 answers

strange string on xml (…)

I see that some rss on xml have strange strings. For example, ... is …. What is this? And why? Its about CDATA? On my web application (C#), reading rss, I usually do myString.Replace("…", "...") : not sure if it's the best strategy
markzzz
  • 47,390
  • 120
  • 299
  • 507
11
votes
6 answers

E4X Add CDATA content

Basically I need to define a node name and its CDATA content using variables. var nodeName:String = "tag"; var nodeValue:String = ""; Naively I thought this would work : var xml:XML =…
Theo.T
  • 8,905
  • 3
  • 24
  • 38
11
votes
5 answers

Decode CDATA section in C#

I have a bit of XML as follows:
I'm accessing it using curXmlNode.SelectSingleNode("description").InnerText but…
Jess
  • 42,368
  • 6
  • 37
  • 51
11
votes
5 answers

How to remove `//` with javascript from string?

How to remove // with javascript from string? var title = "" ; needs to become var title = "A Survey of Applications of…
Alireza
  • 5,444
  • 9
  • 38
  • 50
10
votes
3 answers

How do i write the literal "]]>" inside a CDATA section without it ending the section

Pretty simple question, I'm writing an XML document and i'm not sure how to write "]]>" without it being seen as the end of the section.
GBa
  • 17,509
  • 15
  • 49
  • 67
10
votes
1 answer

LXML kills my CDATA sections

I'm batch-converting a lot of XML files, changing their character encodings to UTF-8: with open(source_filename, "rb") as source: tree = etree.parse(source) with open(destination_filename, "wb") as destination: …
Naftuli Kay
  • 87,710
  • 93
  • 269
  • 411
10
votes
3 answers

Using CDATA element in XML is vulnerable or not?

Is it a vulnerable using CDATA element in XML documents? If so what happens if we use CDATA element in XML documents?
Madhan
  • 2,609
  • 7
  • 26
  • 22
9
votes
5 answers

How to parse XML for

How to parse a XML having data included in
GOK
  • 2,338
  • 6
  • 34
  • 63
9
votes
2 answers

Is it possible to use CDATA inside
 tag

I want to display an exception trace in the HTML page. One way to do this is to escape HTML special characters in the exception trace and dump it inside the
 tag.
Although it works, it's terribly inefficient.  I thought that one approach would…
Alexander Pogrebnyak
  • 44,836
  • 10
  • 105
  • 121
9
votes
3 answers

Javascript and `<>...` tags

So I recently discovered that I could use <>... tags in javascript in Firefox, which is handy when defining blocks of HTML or CSS. GM_addStyle(<>
rampion
  • 87,131
  • 49
  • 199
  • 315
9
votes
3 answers

Convert an xml element whose content is inside CDATA

I have a xml fragment like below welcome to my page
this is paraph
]]> and I want to be able to change the
...
jjennifer
  • 1,285
  • 4
  • 12
  • 22
1 2
3
74 75