473,796 Members | 2,679 Online
Bytes | Software Development & Data Engineering Community
+ 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 11863
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.goo gle.com...
"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********@com cast.net> wrote in message news:<ONnRa.797 05$ye4.59325@sc crnsc01>...
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.goo gle.com...
"Bob Foster" <bo********@com cast.net> wrote in message news:<ONnRa.797 05$ye4.59325@sc crnsc01>...
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.goo gle.com...
"Bob Foster" <bo********@com cast.net> wrote in message

news:<ONnRa.797 05$ye4.59325@sc crnsc01>...
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
11445
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 href="mailto:DrTebi@yahoo.com">DrTebi</a> This would work like a regular mailto link in any browser, but wouldn't be visible to spiders if they don't have a function to decode it.
2
6253
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 print it out, the "&lang" gets converted into some strange character. i.e., just try: alert ("heyhey&lang=blahblah");
9
10516
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 arrow for all browsers and os? -- bye Stephan...
12
47956
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 "&nbsp;" char - the non breaking space. Can this be represented in a grep statement at
0
2182
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 Bob's dog into an Access memo field, I get a string that is 9-characters long. When I read "Bob's dog" from a memo field in a MySQL table attacted to MS Access via MyODBC driver, it displays as "Bob's dog" - a twelve character string. the '...
1
2052
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 gets changed to "&amp;#10" and doesn't render new lines in the Excel sheet. Can anyone help? Many thanks,
8
5345
by: emailmygroup | last post by:
I am trying to decode character ‘#; but it is not working. Anybody knows how to decode this character?
0
904
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 the file. </F>
0
1433
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 search/replace on the "&" char with the "amp&;" prior to parsing??
0
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9535
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10465
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...
1
7558
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
6800
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
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4127
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 we have to send another system
2
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2931
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.