cdata

Storing HTML or XML code in javascript variables

允我心安 提交于 2019-12-02 01:45:32
问题 I'd like to store a some HTML/XML markups in a javascript variable. The problem is that the text is relatively large. For example how can I store the following XML piece in a javascript variable? <QuestionForm xmlns="[the QuestionForm schema URL]"> <Overview> <Title>Game 01523, "X" to play</Title> <Text> You are helping to decide the next move in a game of Tic-Tac-Toe. The board looks like this: </Text> <Binary> <MimeType> <Type>image</Type> <SubType>gif</SubType> </MimeType> <DataURL>http:/

XSL unescape HTML inside CDATA

∥☆過路亽.° 提交于 2019-12-02 00:17:14
I'm trying to transform XML: <catalog> <country><![CDATA[ WIN8 <b>X</b> Mac OS ]]></country> </catalog> into <catalog> <country><![CDATA[ WIN8 <b>X</b> Mac OS ]]></country> </catalog> with an XSL transform. I know that using disable-output-escaping="yes" or cdata-section-elements I could transform escaped characters into unescaped and put inside CDATA, but this does not work if charaters are already inside CDATA. Is there a simple way for this? Thanks. This <catalog> <country><![CDATA[ WIN8 <b>X</b> Mac OS ]]></country> </catalog> is equivalent to <catalog> <country> WIN8 <b>X</b> Mac OS <

Modify ![CDATA[]] in PHP? (XML)

六月ゝ 毕业季﹏ 提交于 2019-12-01 22:52:45
I have an XML file which contains ![CDATA[]] data. Like this: <link><![CDATA[https://google.de]]></link> Now I heard that I can not modify ![CDATA[]] data or that they contains some special characters. But I do not remember anymore... That's the reason why I'am asking here. Can I change the values in ![CDATA[]] and if yes, how? I just want to append something like "?=dadc" on the link. Edit: My XML file structure (Want to edit the url): <?xml version="1.0" encoding="UTF-8"?> <rss> <channel xmlns:g="http://base.google.com/ns/1.0" version="2.0"> <title>Google Eur English 1</title> <description/>

How to access variable in CDATA from XSLT?

流过昼夜 提交于 2019-12-01 21:01:29
I am using XSLT Transformation and need to put some data in CDATA section and that vale is present in a variable. Query: How to access variable in CDATA ? Sample Given Below: <xsl:attribute name ="attributeName"> <![CDATA[ I need to access some variable here like *<xsl:value-of select ="$AnyVarible"/>* ]]> </xsl:attribute> How can I use varibale in CDATA ? Note: I can not use --> <![CDATA[<xsl:value-of select ="$AnyVarible"/>]]> Thanks in advance. Amit I got the solution for this...FYI for everyone... <xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text> <xsl:value-of select ="

How to remove `//<![CDATA[` and end `//]]>` with javascript from string?

╄→гoц情女王★ 提交于 2019-12-01 15:55:51
How to remove //<![CDATA[ and end //]]> with javascript from string? var title = "<![CDATA[A Survey of Applications of Identity-Based Cryptography in Mobile Ad-Hoc Networks]]>" ; needs to become var title = "A Survey of Applications of Identity-Based Cryptography in Mobile Ad-Hoc Networks"; How to do that? You can use the String.prototype.replace method, like: title = title.replace("<![CDATA[", "").replace("]]>", ""); This will replace each target substring with nothing. Note that this will only replace the first occurrence of each, and would require a regular expression if you want to remove

XML parsing : Reading CDATA

梦想与她 提交于 2019-12-01 06:46:51
<item><title>this is title</title><guid isPermaLink="true">http://www.i.com/video/nokia-lumia-920-deki-pureview_2879.html</guid><link>http://www.i.com/video/nokia-lumia-920-deki-pureview_2879.html</link> <description><![CDATA[this is the info.]]></description> <pubDate>Wed, 5 Sep 2012 22:10:00 UT</pubDate> <media:content type="image/jpg" expression="sample" fileSize="2956" medium="image" url="http://media.chip.com.tr/images/content/video/88/201209060102428081-0.jpg"/> <enclosure type="image/jpg" url="http://media.chip.com.tr/images/content/video/88/201209060102428081-0.jpg" length="2956"/><

XML Serialization of HTML

放肆的年华 提交于 2019-12-01 05:53:41
Okay this one DID it! Thanks to all of you! public class Result { public String htmlEscaped { set; get; } [XmlIgnore] public String htmlValue { set; get; } [XmlElement("htmlValue")] public XmlCDataSection htmlValueCData { get { XmlDocument _dummyDoc = new XmlDocument(); return _dummyDoc.CreateCDataSection(htmlValue); } set { htmlValue = (value != null) ? value.Data : null; } } } Result r = new Result(); r.htmlValue = ("<b>Hello</b>"); r.htmlEscaped = ("<b>Hello</b>"); XmlSerializer xml = new XmlSerializer(r.GetType()); TextWriter file = new StreamWriter(Environment.CurrentDirectory + "\

XML parsing : Reading CDATA

陌路散爱 提交于 2019-12-01 04:59:54
问题 <item><title>this is title</title><guid isPermaLink="true">http://www.i.com/video/nokia-lumia-920-deki-pureview_2879.html</guid><link>http://www.i.com/video/nokia-lumia-920-deki-pureview_2879.html</link> <description><![CDATA[this is the info.]]></description> <pubDate>Wed, 5 Sep 2012 22:10:00 UT</pubDate> <media:content type="image/jpg" expression="sample" fileSize="2956" medium="image" url="http://media.chip.com.tr/images/content/video/88/201209060102428081-0.jpg"/> <enclosure type="image

XML Serialization of HTML

旧巷老猫 提交于 2019-12-01 03:26:07
问题 Okay this one DID it! Thanks to all of you! public class Result { public String htmlEscaped { set; get; } [XmlIgnore] public String htmlValue { set; get; } [XmlElement("htmlValue")] public XmlCDataSection htmlValueCData { get { XmlDocument _dummyDoc = new XmlDocument(); return _dummyDoc.CreateCDataSection(htmlValue); } set { htmlValue = (value != null) ? value.Data : null; } } } Result r = new Result(); r.htmlValue = ("<b>Hello</b>"); r.htmlEscaped = ("<b>Hello</b>"); XmlSerializer xml = new

Reading text in `<![CDATA[…]]>` with SimpleXMLElement [duplicate]

霸气de小男生 提交于 2019-11-30 22:03:58
This question already has an answer here: Getting cdata content while parsing xml file 3 answers I'm importing an RSS feed with SimpleXMLElement in PHP. I'm having trouble with the title and description. For some reason, the website I get the feed from puts the title and description in <![CDATA[...]]> : <item> <title><![CDATA[...title...]]></title> <link>...url...</link> <description><![CDATA[...title...]]></description> <pubDate>...date...</pubDate> <guid>...link...</guid> </item> When I do a var_dump() on the SimpleXMLElement, I get (for this part): [2]=> object(SimpleXMLElement)#5 (5) { [