Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JDOM support for unprintable characters

Status
Not open for further replies.

zorrinn

Programmer
Jun 12, 2002
7
CA
Hi

This the situation,

I have unprintable characters that need to be enclosed in an XML tag. For example,

char DATA_ELEM_SEP = 0x1D;

While builiding my XML string using JDOM, it complains that the 0x1D is an illegal XML character. Is there some way that I can use some kind of escape characters to put this in the XML???

Please help. This is urgent.
 
Jonty

can you be a little more elaborate?? Thanks.
 
Special characters in XML are represented by entities. All characters can be represented by a number, like & which is an ampersand (&). Some also can be represented by names (ampersand is also &).

eg:

<xml>a &amp; b</xml>

would be the valid way to say:

<xml>a & b</xml>

Couple of links to look at:

 
That is indeed an illegal character in XML.
However, you can store it as &#1d; and the parser on the other end will convert it back for you.

Chip H.


____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top