473,691 Members | 2,065 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

escape character in XML text string

Hi,

I am generating a XML based file for a system that will generate PCL code
from textual <text>..</text> tag items. The PCL string needs escape
characters. The string within this tag will be transparently forward to a
device that understands escape characters.

How can I include the character ' 27' into the data so that the XML is
properly formed and not rejected.

char c = '\u001b';
string = "ab" + c + "de" will not work.

Any ideas?

Gr. Ricardo

Jul 20 '05 #1
7 10196
* Te********@inte rvisit.com wrote in comp.text.xml:
I am generating a XML based file for a system that will generate PCL code
from textual <text>..</text> tag items. The PCL string needs escape
characters. The string within this tag will be transparently forward to a
device that understands escape characters.

How can I include the character ' 27' into the data so that the XML is
properly formed and not rejected.


You cannot include U+001B literally in XML documents, you need some
method to express U+001B in characters that are allowed in XML. In
common use are Base64 and Hex encoding.
Jul 20 '05 #2
On Wed, 21 Jan 2004 21:44:07 GMT, "Te********@int ervisit.com"
<te********@int ervisit.com> wrote:
How can I include the character ' 27' into the data so that the XML is
properly formed and not rejected.


Tried an entity ?


Jul 20 '05 #3
Andy Dingley wrote:
On Wed, 21 Jan 2004 21:44:07 GMT, "Te********@int ervisit.com"
<te********@int ervisit.com> wrote:

How can I include the character ' 27' into the data so that the XML is
properly formed and not rejected.

Tried an entity ?




Tried yourself?

Anyway: doesn't work. The character is illegal in XML, no matter whether
as entitiy or not.
Jul 20 '05 #4
On Thu, 22 Jan 2004 10:35:33 +0100, Julian Reschke
<ju************ @gmx.de> wrote:
Anyway: doesn't work. The character is illegal in XML, no matter whether
as entitiy or not.


Sorry - gettiing late and I was tired. It's in the forbidden range
(I've never understood why - anyone care to explain the reasoning
behind them ?)

Jul 20 '05 #5
Andy Dingley wrote:
On Thu, 22 Jan 2004 10:35:33 +0100, Julian Reschke
<ju************ @gmx.de> wrote:

Anyway: doesn't work. The character is illegal in XML, no matter whether
as entitiy or not.

Sorry - gettiing late and I was tired. It's in the forbidden range
(I've never understood why - anyone care to explain the reasoning
behind them ?)


Escape sequences are used to control output devices, eg to change fonts,
clear the screen, switch to block graphics mode, and goddess knows what
else.

You really, *really*, REALLY don't want ESC in your output stream, ever,
unless you are writing a device controller.

The OP wanted to use an XML stream for device control, which IMHO is
A Bad Idea. The simple solution is to insert a placeholder like <ESC/>
and pass the file through a transformation stage that *will* output
a \027 character.

///Peter

Jul 20 '05 #6
On Sat, 24 Jan 2004 02:21:44 +0000, Peter Flynn <pe***@silmaril .ie>
wrote:
You really, *really*, REALLY don't want ESC in your output stream, ever,
unless you are writing a device controller.


But what if I am ?

 is a good "XML-like" solution to handling these potentially
volatile characters. Represented as an entity, it ain't going nowhere
(equally for your <ESC/> example).

Expanding the entities (&amp; as an example) already transforms the
input from well-formed XML to something else. I don't see the possible
presence of \027 in here as any more risky than a serial cable's
ability to carry that same octet.

Jul 20 '05 #7
Andy Dingley wrote:
On Sat, 24 Jan 2004 02:21:44 +0000, Peter Flynn <pe***@silmaril .ie>
wrote:

You really, *really*, REALLY don't want ESC in your output stream, ever,
unless you are writing a device controller.

But what if I am ?

 is a good "XML-like" solution to handling these potentially
volatile characters. Represented as an entity, it ain't going nowhere
(equally for your <ESC/> example).

Expanding the entities (&amp; as an example) already transforms the
input from well-formed XML to something else. I don't see the possible
presence of \027 in here as any more risky than a serial cable's
ability to carry that same octet.


In fact, generating *XML* and sending it directly to a device that
expects ESCs makes little sense. However, it's perfectly plausible to
use XSLT's text output method to produce this kind of output. Right now,
this doesn't work out-of-the-box.

One approach is to define placeholders such as <esc/> and have a special
output method to translate those (I think many Java based XSLT engines
allow you to define custom output methods).

This issue may also get solved by XML 1.1
(<http://www.w3.org/TR/xml11/#sec-xml11>). Is anybody aware of changes
in XSLT 2.0?

Julian
Jul 20 '05 #8

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

Similar topics

4
21409
by: Alden Streeter | last post by:
Here is the HTML that is being output by my asp page: <a href='Files/category/computers/bigimages/computers-sub-monitors.jpg' target='_blank' onMouseOver="window.status='Click for a larger image of MONITOR, 19\" CODAR EAGLE.';return true;" onMouseOut="window.status='';return true;"> <img width='98' height='96' border='0' src='Files/category/computers/bigimages/computers-sub-monitors.jpg' alt='MONITOR, 19" CODAR EAGLE'></a>
7
96305
by: teachtiro | last post by:
Hi, 'C' says \ is the escape character to be used when characters are to be interpreted in an uncommon sense, e.g. \t usage in printf(), but for printing % through printf(), i have read that %% should be used. Wouldn't it have been better (from design perspective) if the same escape character had been used in this case too. Forgive me for posting without verfying things with any standard compiler, i don't have the means for now.
18
7183
by: Steve Litvack | last post by:
Hello, I have built an XMLDocument object instance and I get the following string when I examine the InnerXml property: <?xml version=\"1.0\"?><ROOT><UserData UserID=\"2282\"><Tag1 QID=\"55111\"><Tag2 AID=\"5511101\"></Tag2></Tag1><Tag1 QID=\"55112\"><Tag2 AID=\"5511217\"></Tag2></Tag1><Tag1 QID=\"5512282\"><Tag2 AID=\"551228206\"></Tag2></Tag1><Tag1 QID=\"55114\"><Tag2 AID=\"5511406\"></Tag2></Tag1><Tag1 QID=\"55115\"><Tag2
4
7469
by: Guadala Harry | last post by:
I need to place the following into a string... How can I properly escape the % " / < and > characters? <table width="100%" border="0" cellspacing="0" cellpadding="4px" class="hfAll"></Table> Thanks.
12
9633
by: Jeff S | last post by:
In a VB.NET code behind module, I build a string for a link that points to a JavaScript function. The two lines of code below show what is relevant. PopupLink = "javascript:PopUpWindow(" & Chr(34) & PopUpWindowTitle & Chr(34) & ", " & Chr(34) & CurrentEventDetails & ")" strTemp += "<BR><A HREF='#' onClick='" & PopupLink & "'>" & EventName & "</A><BR>" The problem I have is that when the string variables or contain a string with an...
15
18314
by: pkaeowic | last post by:
I am having a problem with the "escape" character \e. This code is in my Windows form KeyPress event. The compiler gives me "unrecognized escape sequence" even though this is documented in MSDN. Any idea if this is a bug? if (e.KeyChar == '\e') { this.Close(); }
131
9234
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 you pass a second argument of True (the default is False): 'the "quick" &amp; &lt;brown&gt; fox' 'the &quot;quick&quot; &amp; &lt;brown&gt; fox' This seems to me to be dumb. The default option should be the safe one: that is, escape _all_ the potentially troublesome...
6
6301
by: sloan | last post by:
I have a fairly simple RegEx code below. I am given a file name, (which I don't control) , and need to change a folder name in it. The code below is choking on the filename not being escaped. "Unrecognized escape sequence"
3
8655
by: qilin | last post by:
I am trying to save a big text string into MySQL, but I guess i need escape the string firstly, anybody knows any escape function in c for that? or any other suggests ?
5
15678
by: vlsidesign | last post by:
The printf function returns "warning: unknown escape sequence: \040" for a backslash-space combination. If the ascii decimal number for space is 32 and the backslash is 92, why this particular number 040? Is it a decimal number from the ASCII code chart? (compiling using gcc on SunOS 5.8, Sparc, Ultra-80) Just curious. Thanks.
0
9079
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8796
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7626
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6457
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5817
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4322
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4553
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2234
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1954
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.