472,333 Members | 1,072 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,333 software developers and data experts.

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 10154
* Te********@intervisit.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********@intervisit.com"
<te********@intervisit.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********@intervisit.com"
<te********@intervisit.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
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'...
7
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...
18
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...
4
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"...
12
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....
15
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...
131
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 '"'....
6
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...
3
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...
5
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...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...

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.