473,466 Members | 1,554 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 11810
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 like this: <a...
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 "&lang=" in any string value in javascript, and try to...
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 square with a kind of a star. How can I get a right...
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 is that this doesn't trim instances of the...
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 when typed into a MySQL memo field? If I type...
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 chars in the .innertext to XML-compliant " "; It...
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 semicolon. bare ampersands must be written as "&amp;" in...
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 this... or are you saying I should do a...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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...
0
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,...
0
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
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.