473,513 Members | 2,263 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need to escape ]]>

DC
Hi,

I have to somehow place this fragment into a CDATA block: ]]>

Example:

<replace><![CDATA[]]></text>]]></replace>

Of course that does not work since the first ]]will close the CDATA
block already. Can I escape it somehow?

TIA for any hints!

Regards
DC

Sep 18 '07 #1
2 2116
DC wrote:
I have to somehow place this fragment into a CDATA block: ]]>

Example:

<replace><![CDATA[]]></text>]]></replace>

Of course that does not work since the first ]]will close the CDATA
You need to break that up into two CDATA sections e.g.
<replace><![CDATA[]]]]><![CDATA[></text>]]></replace>

XmlWriter can free you from such hassles by using the WriteCData method
e.g. the above will be created by

writer.WriteStartElement("replace");
writer.WriteCData("]]></text>");
writer.WriteEndElement();


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Sep 18 '07 #2
DC
On 18 Sep., 19:10, Martin Honnen <mahotr...@yahoo.dewrote:
DC wrote:
I have to somehow place this fragment into a CDATA block: ]]>
Example:
<replace><![CDATA[]]></text>]]></replace>
Of course that does not work since the first ]]will close the CDATA

You need to break that up into two CDATA sections e.g.
<replace><![CDATA[]]]]><![CDATA[></text>]]></replace>

XmlWriter can free you from such hassles by using the WriteCData method
e.g. the above will be created by

writer.WriteStartElement("replace");
writer.WriteCData("]]></text>");
writer.WriteEndElement();

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Perfect, thank you Martin!

Regards
DC

Sep 19 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
4868
by: yawnmoth | last post by:
say i have a for loop that would iterate through every character and put a space between every 80th one, in effect forcing word wrap to occur. this can be implemented easily using a regular...
16
5930
by: Luis P. Mendes | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I only know a little bit of xml and I'm trying to parse a xml document in order to save its elements in a file (dictionaries inside a list)....
35
37928
by: Boobie | last post by:
I need to escape HTML chracters so <test> --> &lt;test&gt; Looks like there is no built-in JS function...anyone got one handy ? thanks
3
5354
by: beanweed | last post by:
I have an Oracle Procedure that returns xml. There was an exception thrown when I tried to load an XmlDocument (using LoadXml(String)) because the value returned from Oracle had an exclamation mark...
131
9148
by: Lawrence D'Oliveiro | last post by:
The "escape" function in the "cgi" module escapes characters with special meanings in HTML. The ones that need escaping are '<', '&' and '"'. However, cgi.escape only escapes the quote character if...
2
28091
by: Richard Lewis Haggard | last post by:
Is it possible to use features from XmlDocument to unescape text back to its original raw text format after it has been escaped to handle non-HTML compliant character strings? I have code that...
1
7618
by: Philipp | last post by:
How do I convert a string to escaped HTML? (Let's say I'm not using DOM.) E.g. "<p>foo</p>" would become "&lt;p&gt;foo&lt;/p&gt;"? Reversely, how do I unescape a string to be HTML? E.g. "&lt;em&gt;" would turn...
6
3366
by: ARC | last post by:
I know this should be simple, but in a sub-routine that's printing a large batch of reports, how do you code the routine to look for an escape key to allow the user to break out? Thanks! Andy
1
4180
by: RK | last post by:
Perhaps I'm confused somwhere in my understanding, but I'm trying to deal with some escaped text from an XML file which includes html markup and it appears there are a couple of techniques for...
0
7265
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7171
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7388
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7114
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5098
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3240
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3230
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
461
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.