cdata

What exactly is CDATA and what does it do?

末鹿安然 提交于 2019-11-30 18:52:26
I sometimes notice a CSS or JS code surrounded with <![CDATA[ and ]]> tags. I couldn't find any explanation to this. What does CDATA do? Why is it used by some people and what is it needed for? It tells the interpreter that it should not try to interpret the data enclosed in the tags. For example, if you want a XML file to contain a comment with < or >, XML interpreters will report the file as invalid because the caracters < and > will not be part of standard tag. You simply have to surround the code with the CDATA tags. It marks data that shouldn't be parsed - in most cases, just HTML or text

what actually is PCDATA and CDATA?

放肆的年华 提交于 2019-11-30 13:39:33
问题 it seems that a loose definition of PCDATA and CDATA is that PCDATA is character data, but is to be parsed. CDATA is character data, and is not to be parsed. but then someone told me that CDATA is actually parsed or PCDATA is actually not parsed... so it is a bit of a confusion. Does anyone know the real deal is? Update : I actually added the PCDATA definition on Wikipedia... so don't take that answer too seriously as that's only my rough understanding of it. 回答1: From WIKI: PCDATA Simply

Rendering HTML Tags from within CDATA tag in XSL

99封情书 提交于 2019-11-30 12:02:18
I have a CDATA tag within my XML code which contains some hyperlinks. <smartText><![CDATA[ Among individual stocks, the top percentage gainers in the S.&P. 500 are <a href ='http://investing.domain.com/research/stocks/snapshot /snapshot.asp?ric=LNC'>Lincoln National Corp</a> and <a href ='http://investing.domain.com/research/stocks/snapshot /snapshot.asp?ric=PLD'>ProLogis</a>.]]> </smartText> I am trying to transform it into an HTML page as follows... <p class="smartText"> <xsl:copy-of select="marketSummaryModuleData/smartText"/> </p> Unfortunately the output onto the page shows up in pure

SQL Server XML output with CDATA

孤街浪徒 提交于 2019-11-30 08:37:03
问题 Is there a way to have an SQL Server XML return use CDATA? I have XML being returned by SQL Server like this: <locations> <site id="124"> <sitename>Texas A & M</sitename> </site> </locations> When I am required to have this: <locations> <site id="124"> <sitename><![CDATA[Texas A & M]]></sitename> </site> </locations> 回答1: Look at the options of FOR XML EXPLICIT (parameter Directive ). It gives the greater degree of control and you can also specify CDATA. Here is a good tutorial. And the code

what actually is PCDATA and CDATA?

谁说我不能喝 提交于 2019-11-30 08:10:27
it seems that a loose definition of PCDATA and CDATA is that PCDATA is character data, but is to be parsed. CDATA is character data, and is not to be parsed. but then someone told me that CDATA is actually parsed or PCDATA is actually not parsed... so it is a bit of a confusion. Does anyone know the real deal is? Update : I actually added the PCDATA definition on Wikipedia... so don't take that answer too seriously as that's only my rough understanding of it. From WIKI: PCDATA Simply speaking, PCDATA stands for Parsed Character Data. That means the characters are to be parsed by the XML, XHTML

What exactly is CDATA and what does it do?

柔情痞子 提交于 2019-11-30 01:56:54
问题 I sometimes notice a CSS or JS code surrounded with <![CDATA[ and ]]> tags. I couldn't find any explanation to this. What does CDATA do? Why is it used by some people and what is it needed for? 回答1: It tells the interpreter that it should not try to interpret the data enclosed in the tags. For example, if you want a XML file to contain a comment with < or >, XML interpreters will report the file as invalid because the caracters < and > will not be part of standard tag. You simply have to

Rendering HTML Tags from within CDATA tag in XSL

ⅰ亾dé卋堺 提交于 2019-11-29 18:35:04
问题 I have a CDATA tag within my XML code which contains some hyperlinks. <smartText><![CDATA[ Among individual stocks, the top percentage gainers in the S.&P. 500 are <a href ='http://investing.domain.com/research/stocks/snapshot /snapshot.asp?ric=LNC'>Lincoln National Corp</a> and <a href ='http://investing.domain.com/research/stocks/snapshot /snapshot.asp?ric=PLD'>ProLogis</a>.]]> </smartText> I am trying to transform it into an HTML page as follows... <p class="smartText"> <xsl:copy-of select

Wrapping and removing CDATA around XML

…衆ロ難τιáo~ 提交于 2019-11-29 18:02:04
This is my xml. My goal is to wrap the data inside the Value node with CDATA on an export and then import that back into an Xml type column with the CDATA removed. <Custom> <Table>Shape</Table> <Column>CustomScreen</Column> <Value>Data</Value> <Custom> Right now I am replacing 'Data' inside the Value node with the XML from the table and then I believe I am putting CData around it, Where ShapeInfo is type XML and CustomPanel is the first node of [ShapeInfo] XML. SET @OutputXML= replace(@OutputXML, 'Data', CAST((SELECT [ShapeInfo] FROM [Shape] WHERE [Shape_ID] = @ShapeID) as VARCHAR(MAX)) SET

SQL SERVER xml with CDATA

自作多情 提交于 2019-11-29 17:32:26
I have a table in my database with a column containing xml. The column type is nvarchar(max). The xml is formed in this way <root> <child>....</child> . . <special> <event><![CDATA[text->text]]></event> <event><![CDATA[text->text]]></event> ... </special> </root> I have not created the db, I cannot change the way information is stored in it but I can retrieve it with a select. For the extraction I use select cast(replace(xml,'utf-8','utf-16')as xml) from table It works well except for cdata, whose content in the query output is: text -> text Is there a way to retrieve also the CDATA tags? Well

Getting HTML from XML with JavaScript/jQuery

房东的猫 提交于 2019-11-29 15:49:25
I've got an XML document that contains a tag that has well-formed HTML content. I need to get that HTML into my page using JavaScript. However, due to CMS issues, the HTML CANNOT be escaped with < ![CDATA[ ]]> or anything else, and the <> must be present, not encoded to &lt ; &gt ; <submenu> <content> <div> <h3>Hello World</h3> <p>Lorem <a href="ipsum.html">ipsum</a></p> </div> </content> </submenu> I've used jQuery to get the XML and put the submenu's into an array. I'm able to get the text with: $(menuArray[n]).find('content').text(); However, this just returns "Hello World Lorem ipsum". I