473,606 Members | 2,080 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 11841
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
11431
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
6236
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
10507
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
47620
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
2167
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
2039
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
5326
by: emailmygroup | last post by:
I am trying to decode character ‘#; but it is not working. Anybody knows how to decode this character?
0
898
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
1410
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
8009
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
7938
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
8430
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...
0
6752
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5892
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
3914
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3962
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2441
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
0
1279
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.