472,334 Members | 1,523 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Character reference "&#c" is an invalid XML character

"Character reference "&#c" is an invalid XML character"
With JDOM and Xerces in Java, I get the above error with sequences.
I need to be able to encode arbitrary char sequences in xml.

any suggestions?

--
CB
Jul 20 '05 #1
6 11733
In article <f3**************************@posting.google.com >,
cgbusch <cg*****@yahoo.com> wrote:
"Character reference "&#c" is an invalid XML character"
With JDOM and Xerces in Java, I get the above error with sequences.
That's right. You can't put that character in an XML 1.0 document
even by using a character reference. (Why is there this restriction?
The usual answer is that XML is a text format, not a binary format.)
I need to be able to encode arbitrary char sequences in xml.


You'll have to really encode them, and translate them back again in
your application. If you just need to represent ascii characters
including controls, you could use some other Unicode characters
such as the private use characters (this would make translation
easy). Or you could encode everything using, say, base-64. Or
you could use an element to represent the illegal characters,
something like <char code="12"/>.

-- Richard

--
Spam filter: to mail me from a .com/.net site, put my surname in the headers.

FreeBSD rules!
Jul 20 '05 #2
base64, hex.

XML doesn't allow arbitrary characters.

Bob

"cgbusch" <cg*****@yahoo.com> wrote in message
news:f3**************************@posting.google.c om...
"Character reference "&#c" is an invalid XML character"
With JDOM and Xerces in Java, I get the above error with sequences.
I need to be able to encode arbitrary char sequences in xml.

any suggestions?

--
CB

Jul 20 '05 #3
"Bob Foster" <bo********@comcast.net> wrote in message news:<ONnRa.79705$ye4.59325@sccrnsc01>...
base64, hex.

XML doesn't allow arbitrary characters.

Bob

I guess XML 1.1 allows all chars except ascii 0 because of lame C. So
for now I can just switch to that and hope that 1.2 will allow �
MSXML allows all ASCII chars.
Jul 20 '05 #4
"cgbusch" <cg*****@yahoo.com> schrieb im Newsbeitrag
news:f3**************************@posting.google.c om...
"Bob Foster" <bo********@comcast.net> wrote in message news:<ONnRa.79705$ye4.59325@sccrnsc01>...
base64, hex.

XML doesn't allow arbitrary characters.

Bob

I guess XML 1.1 allows all chars except ascii 0 because of lame C. So
for now I can just switch to that and hope that 1.2 will allow �


XML 1.1 isn't finished yet.
MSXML allows all ASCII chars.


Not true. This bug has been fixed in MSXML3.

Jul 20 '05 #5
"cgbusch" <cg*****@yahoo.com> wrote in message
news:f3**************************@posting.google.c om...
"Bob Foster" <bo********@comcast.net> wrote in message

news:<ONnRa.79705$ye4.59325@sccrnsc01>...
base64, hex.

XML doesn't allow arbitrary characters.

Bob

I guess XML 1.1 allows all chars except ascii 0 because of lame C. So
for now I can just switch to that and hope that 1.2 will allow �
MSXML allows all ASCII chars.


Naw, you're just heading further down the wrong path. Encode the data to use
it within XML. There are no loopholes.

Bob
Jul 20 '05 #6
"Richard Tobin" <ri*****@cogsci.ed.ac.uk> wrote in message
news:bf***********@pc-news.cogsci.ed.ac.uk...
In article <f3**************************@posting.google.com >,
cgbusch <cg*****@yahoo.com> wrote:
I guess XML 1.1 allows all chars except ascii 0 because of lame C.
You mean "because it would break existing APIs for negligible gain".
So for now I can just switch to that and hope that 1.2 will allow �


I think you will be disappointed.


So many people have this "what do I type to just make it work" attitude. I
don't even bother replying to them anymore. Let them crash & burn and cost
their company (or, these days, the company that outsourced to them) valuable
time & money as they scramble to fix these mistakes. Maybe then the hiring
managers will start to realize that perhaps not all people who put "XML" on
their resume are of equal proficiency. (Yes I know this rant won't help me
get a job in the field, but after 18 months of unemployment with no sign of
recovery unless I move to India, I'm understandably bitter).
FreeBSD rules!


Agreed.
Jul 20 '05 #7

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

Similar topics

1
by: DrTebi | last post by:
Hello, I have the following problem: I used to "encode" my email address within links, in order to avoid (most) email spiders. So I had a link...
2
by: Genzo | last post by:
Hi all, was wondering if anyone might have knowledge on this. am testing with Opera 7.11. essentially whenever i try to use the substring...
9
by: Stephan Koser | last post by:
Hi, on my website i have some $rarr; tags - that shows usually a right arrow. Now I have Windows XP Professional and IE 6.0.x and it shows a...
12
by: Robert Mark Bram | last post by:
Hi All, I am using the following trim function: function trim (str) { return str.replace(/^\s*/g, '').replace(/\s*$/g, ''); } The problem...
0
by: MLH | last post by:
Is an apostrophe a character of special significance to MySQL in a way that would cause "Bob's dog" to become translated into a 12-character string...
1
by: st | last post by:
Hi, I'm using xmlDocument.Save(xmlTextWriter) to create an Excel-readable file. All works well, except where I've replaced the carriage return...
8
by: emailmygroup | last post by:
I am trying to decode character ‘#; but it is not working. Anybody knows how to decode this character?
0
by: Fredrik Lundh | last post by:
bruce wrote: that's because your parser is interpreting the &E part as an entity reference, and the serializer is then adding the missing...
0
by: bruce | last post by:
Hi Fredrick Thanks for the reply. But since I don't have control of the initial text, is there something with python that will strip/replace...
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: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
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...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
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: 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...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

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.