cdata

Storing base64 data in XML?

不问归期 提交于 2019-11-27 22:55:18
问题 How I can store base64 strings in XML? Do you use CDATA to store base64 strings in XML? Would it help as it allows use of < > within the strings? Is base64 configurable where you tell it not to use certain chars if they conflict with XML? 回答1: You can just store it as a text or attribute value; no escaping or CDATA sections needed. The standard base 64 characters + and / (other than a-z , A-Z and 0-9 ) do not interfere with XML parsing at all. 回答2: Base64 only uses alphanumeric characters and

Using CDATA inside another CDATA

穿精又带淫゛_ 提交于 2019-11-27 22:47:26
I have this difficult situation where I need to use the CDATA tags inside another CDATA tags. The situation is simple to explain though. I have the following thing: <edit> <![CDATA[ <script type="text/javascript"> <![CDATA[ window.onload = function() { document.getElementById('block').onclick = function() { this.onclick = ''; this.value = '{LA_SEND_CONFIRM}'; this.className = this.className.replace('button1',''); document.getElementById('replacement').value = '{LA_BLOCK_CODE}'; } } ]]> </script> ]]> </edit> I need to wrap my Javascript inside CDATA too for showing purposes, so when I open that

How can i grab CData out of BeautifulSoup

倖福魔咒の 提交于 2019-11-27 22:31:57
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 help keep my learning curve down as I'm a python novice. Specifically, I want to get at the two different types of data hidden in the CData statement. the first which is just text I'm pretty sure I can throw a regex at it and get what I need. For the second type, if i could drop the data that has html elements into it's own beautifulsoup, I can parse

Using NSXMLParser with CDATA

无人久伴 提交于 2019-11-27 20:47:01
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 <!CDATA <a href="http:image..etc> How do I add that as my cell image in my table view? Would I define that as an image type? This is what i'm using to do my parsing: - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{ //NSLog(@"found this element: %@", elementName); currentElement = [elementName copy]; if ([elementName

Decode CDATA section in C#

心已入冬 提交于 2019-11-27 16:15:26
问题 I have a bit of XML as follows: <section> <description> <![CDATA[ This is a "description" that I have formatted ]]> </description> </section> I'm accessing it using curXmlNode.SelectSingleNode("description").InnerText but the value returns \r\n This is a "description"\r\n that I have formatted instead of This is a "description" that I have formatted. Is there a simple way to get that sort of output from a CDATA section? Leaving the actual CDATA tag out seems to have it return the same way.

Use CDATA to store raw binary streams?

不羁的心 提交于 2019-11-27 15:12:47
Instead of the overhead with saving binary as Base64 , I was wondering if you could directly store double-byte binary streams into XML files, using CDATA, or commenting it out, or something? You can store it as CDATA, but there's the risk that some byte sequences will evaluate to valid XML that closes the CDATA section. After a quick look at http://www.w3.org/TR/2006/REC-xml-20060816/#sec-cdata-sect , it seems you can have any sequence of chars except "]]>". Have a look at what is a valid XML char too. The Nul character ( '\0' in C ) is not valid anywhere in XML, even as an escape ( & #0; ).

Should I use “]]>” or “//]]>” for closing a CDATA section into xHTML

我怕爱的太早我们不能终老 提交于 2019-11-27 13:14:07
问题 I want to inline scripts or CSSs into XHTML without escaping special characters. I can do that using a CDATA marked section. According to http://www.w3.org/TR/xhtml1/#h-4.8 the CDATA section can be defined as: <script type="text/javascript"> <![CDATA[ ... unescaped script content ... ]]> </script> Then, according to http://www.w3schools.com/TAGS/tag_script.asp, the CDATA can look like: <script type="text/javascript"><![CDATA[ // some code //]]></script> Which method for closing the CDATA

Wrap properties with CData Section - XML Serialization C#

旧时模样 提交于 2019-11-27 09:50:30
I need to serialize my object in such a way that the properties I want, would get wrapped around CData sections. I was hoping I could do something like this : public class Order { [JsonProperty] public int OrderId { get; set; } [JsonProperty] public string Name { get; set; } [JsonProperty] public int Type { get; set; } [JsonProperty] public decimal Amount { get; set; } [JsonProperty] public DateTime Date { get; set; } [DataMember] [JsonProperty] **[WrapCData]** public List<Option> ListB { get; set; } [DataMember] public List<string> ListC { get; set; } **[WrapCData]** public Product Product {

Add CDATA to an xml file

让人想犯罪 __ 提交于 2019-11-27 09:28:13
I would like to add some CDATA tags around some xml tags XML source is (it's only a small part of my file) <teaserText_fr> <div xmlns:xlink="http://www.w3.org/1999/xlink xmlns="http://www.coremedia.com/2003/richtext-1.0"><p>2012 ist für viele Länder ein wichtiges Wahljahr. Die Reihe fühlt der weltweiten Demokratie auf den Zahn. </p> </div> </teaserText_fr> What I would like is <teaserText_fr> <![CDATA[ <div xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.coremedia.com/2003/richtext-1.0"><p>2012 ist für viele Länder ein wichtiges Wahljahr. Die Reihe fühlt der weltweiten Demokratie

Convert an xml element whose content is inside CDATA

南楼画角 提交于 2019-11-27 09:17:37
I have a xml fragment like below <Detail uid="6"> <![CDATA[ <div class="heading">welcome to my page</div> <div class="paragraph">this is paraph</div> ]]> </Detail> and I want to be able to change the <div class="heading">...</div> to <h1>Welcome to my page</h1> <div class="paragraph">...</div> to <p>this is paragraph</p> do you know how I can do that in xslt 1.0 What about running two transforms. Pass 1.) <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes" encoding="UTF-8"/> <xsl:template