f



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
0
cgbusch (6)
7/16/2003 11:09:18 PM
comp.text.xml 8781 articles. 0 followers. Post Follow

6 Replies
3730 Views

Similar Articles

[PageSpeed] 49

In article <f35fca54.0307161509.78787a6f@posting.google.com>,
cgbusch <cgbusch@yahoo.com> wrote:

>"Character reference "&#c" is an invalid XML character"
>With JDOM and Xerces in Java, I get the above error with &#12; 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!
0
richard91 (3692)
7/16/2003 11:40:48 PM
base64, hex.

XML doesn't allow arbitrary characters.

Bob

"cgbusch" <cgbusch@yahoo.com> wrote in message
news:f35fca54.0307161509.78787a6f@posting.google.com...
> "Character reference "&#c" is an invalid XML character"
> With JDOM and Xerces in Java, I get the above error with &#12; sequences.
> I need to be able to encode arbitrary char sequences in xml.
>
> any suggestions?
>
> --
> CB


0
bobkfoster (82)
7/17/2003 2:24:46 AM
"Bob Foster" <bobkfoster@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 &#0; 
MSXML allows all ASCII chars.
0
cgbusch (6)
7/17/2003 2:19:56 PM
"cgbusch" <cgbusch@yahoo.com> schrieb im Newsbeitrag
news:f35fca54.0307170619.547668ed@posting.google.com...
> "Bob Foster" <bobkfoster@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 &#0;

XML 1.1 isn't finished yet.

> MSXML allows all ASCII chars.

Not true. This bug has been fixed in MSXML3.





0
reschke (28)
7/17/2003 3:02:21 PM
"cgbusch" <cgbusch@yahoo.com> wrote in message
news:f35fca54.0307170619.547668ed@posting.google.com...
> "Bob Foster" <bobkfoster@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 &#0;
> 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


0
bobkfoster (82)
7/21/2003 6:42:08 PM
"Richard Tobin" <richard@cogsci.ed.ac.uk> wrote in message
news:bf6e1t$2lt8$1@pc-news.cogsci.ed.ac.uk...
> In article <f35fca54.0307170619.547668ed@posting.google.com>,
> cgbusch <cgbusch@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 &#0;
>
> 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.


0
mike8797 (7)
9/2/2003 7:04:09 PM
Reply:

Similar Artilces:

file command: "XML document text" vs "XML document text"
I've just used the file command on four files of RDF-XML with the following output: augtfidf.rdf: XML document text kyoto.rdf: XML document text stuff.rdf: XML document text tfidf.rdf: XML document text What does it mean that one of them has an extra space between "XML" and "document"? -- The kid's a hot prospect. He's got a good head for merchandising, an agent who can take you downtown and one of the best urine samples I've seen in a long time. [Dead Kennedys t-shirt] On 16.10.2012 16:06, Adam Funk wrote: > I've just used the file command on four files of RDF-XML with the > following output: > > augtfidf.rdf: XML document text > kyoto.rdf: XML document text > stuff.rdf: XML document text > tfidf.rdf: XML document text > > What does it mean that one of them has an extra space between "XML" > and "document"? Hard to tell without further information. What does file *.rdf | od -c show you? Janis Janis Papanagnou wrote: > On 16.10.2012 16:06, Adam Funk wrote: >> I've just used the file command on four files of RDF-XML with the >> following output: >> >> augtfidf.rdf: XML document text >> kyoto.rdf: XML document text >> stuff.rdf: XML document text >> tfidf.rdf: XML document text >> >> What does it mean that one ...

"Invalid hexadecimal character reference" error parsing an XML with SAX processor
Hy to everyone I have created a simple SAX parser for a very simple XML file. When I run the code that follows I get this error: "Invalid hexadecimal character reference" The strange thing is If I change the "chunk size" for the data I send to the parser, the error row changes. This behaviour is very strange! I have done a one more test and I have set the chunkSize equals to the file size and I have the same error at the end of the file. The same XML file processed with another language doesn't raise any error. I use PHP 5.2.3 and a LAMP (AppServ Open Project - 2...

Tidy transforms "&amp;" in the source-xml into a "&"
Hi, 2 issues left with my tidy-work: 1) Tidy transforms a "&amp;" in the source-xml into a "&" in the tidied version. My XML-Importer cannot handle it 2) in a long <title>-string a wrap is produced like: <title>my very long title blab la blab la Blabla bla </title> Importer also has got problems with it My tidy.bat tidy.exe --output-xhtml yes --show-body-only yes --new-blocklevel-tags component,bblocation,title2,short_intro,long_intro,date,reference,category,image_small,image_medium,image_large,body2,external_link_text1,external_link_url1 --indent auto --write-back yes %1 regards Ragnar Ragnar wrote: > 1) Tidy transforms a "&amp;" in the source-xml into a "&" in the tidied > version. Hold it a moment -- if your source is XML, why are you going through Tidy? Having said that, this shouldn't happen in XHTML output mode. Contact Tidy's authors, and/or show us a failing example so we can crosscheck this and make sure > 2) in a long <title>-string a wrap is produced like: > <title>my very long title blab la blab la > Blabla bla </title> > Importer also has got problems with it Turn off auto-indent. -- () ASCII Ribbon Campaign | Joe Kesselman /\ Stamp out HTML e-mail! | System architexture and kinetic poetry On Sat, 04 Nov 2006 10:17:58 -0500, Joe Kesselman <keshlam-nospam@comcast.net> wrote: >Hold it a moment -- i...

XML problem with special characters like "<" and ">"
Hello! I prepare my XML document like this way: ------------------------------------------------------- PrintWriter writer; Document domDocument; Element domElement; // Root tag domElement = domDocument.createElement ("ROOT_TAG"); domDocument.appendChild (domElement); // XML from an external source as a "String" Text data = domDocument.createTextNode (externalXML); domElement.appendChild (data); writer.println (...); ------------------------------------------------------- As you can see, I create a normal Root-Node and then I get an XML stream from an external source. For the external XML I use the function "createTextNode" because it is a text in some way. The problem is the output when I write all together to the PrintWriter object. It looks like this for this example: -------------------------------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <ROOT_TAG> &lt;DATA&gt; &lt;AFL&gt; &lt;AFLNR&gt;XX&lt;/AFLNR&gt; &lt;BENENNUNG&gt;MY TEST&lt;/BENENNUNG&gt; &lt;LA_VER&gt;&lt;/LA_VER&gt; &lt;FA_KR&gt;&lt;/FA_KR&gt; &lt;POL_COD&gt;&lt;/POL_COD&gt; &lt;FA_KZ&gt;&lt;/FA_KZ&gt; &lt;G_KZ&gt;&lt;/G_KZ&gt; &lt;AFL_KZ&gt;1&lt;/AFL_KZ&gt; &lt;/AFL&gt; &lt;/DATA&gt; </ROOT_TAG> -...

XML problem with special characters like "<" and ">"
Hello! I prepare my XML document like this way: ------------------------------------------------------- PrintWriter writer; Document domDocument; Element domElement; // Root tag domElement = domDocument.createElement ("ROOT_TAG"); domDocument.appendChild (domElement); // XML from an external source as a "String" Text data = domDocument.createTextNode (externalXML); domElement.appendChild (data); writer.println (...); ------------------------------------------------------- As you can see, I create a normal Root-Node and then I get an XML stream from an external source....

What XML technologies to learn first for "XML Processing" and "XML Mapping"?
Hi, Doing job interviews. I know XML basics, but I want to familiarize myself with the best that XML has to offer at the moment. What do I need to learn? In other words, what is the dominant XML technology being used at the moment for processing? What is the 'struts' of the XML world? I've used a bit of JDOM, DOM4J, and JAXB. I know there are other xml-to-java serialization-type technologies out there that are less cumbersome - which do I need to know first? Which are most interesting? Which could become market leaders? Also, what are alternatives, if any, to XML? I know...

What does "Standard C", "K&R C" , "ANSI C" mean?
I am just wondering what the following terms usually mean: 1) "Standard C" 2) "K&R C" 3) "ANSI C" I am pretty sure "ANSI C" usually refers to the C89 standard, but what about the other two? What is the "saying" for C99 standard? Thank you On 17 Jan 2005 21:26:42 -0800, "Luke Wu" <LookSkywalker@gmail.com> wrote in comp.lang.c: > I am just wondering what the following terms usually mean: > > 1) "Standard C" The current version of the C language standard. This is now known as "ISO/IEC 9899:19...

"_" on first character -> ORA-00911: invalid character
Hi In SQL command od Oracle 9i I look error because "_" is invalid character. examle: grant all on _USER_REPL_NESTED_TABLE_NAMES to baza_prog_admin * ERROR at line 1: ORA-00911: invalid character Why "_" on first character is invalid? On Apr 1, 7:54=A0am, "Karol" <n...@mail.com> wrote: > Hi > In SQL command od Oracle 9i =A0I =A0look error because "_" is invalid cha= racter. > > =A0 =A0 =A0 =A0 examle: > =A0 =A0 =A0 =A0 grant all on _USER_REPL_NESTED_...

To find termination character of &quot;&gt;&quot;
Hi, &nbsp;&nbsp;&nbsp; I am trying to retrieve data from an instruments through serial port. &nbsp;&nbsp;&nbsp; I dont know exactly the byte count.But i know that&nbsp; the data will end &nbsp;&nbsp;&nbsp; with character :&gt;". &nbsp; &nbsp;&nbsp;&nbsp; For "/n" we are giving termination character "A" in hexadecimal and "10" &nbsp;&nbsp;&nbsp; in decimal.Like that what should i given as termination character for "&gt;". &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&...

["a", "b", "c", "d"] to "a, b, c, d"?
I want to process each element of an array, but the last element should be handled special. Here is an example: def p_ary(ary) str = "" ary.each do |elem| str << elem << ", " end str.chomp!(", ") str end so p_ary(["a", "f", "x", "test"]) produces "a, f, x, test". The code works, but isn't there an easier and more general way for this behaviour? martinus On Tue, 06 Apr 2004 04:23:22 -0700, Martin wrote: > I want to process each element of an array, but the last ele...

"a < b < c" not the same as "(a < b) && (b < c)"?
In math this expression: (a < b) && (b < c) would be described as: a < b < c But why is it that in C these two expressions evaluate to something different for the same values of a, b and c? e.g: for a = 0, b = 3 and c = 2: a < b < c = 1 (a < b) && (b < c) = 0 when typed in C. "Paminu" <jadajada@asd.com> wrote in message news:diisn6$8df$1@news.net.uni-c.dk... > In math this expression: > > (a < b) && (b < c) > > would be described as: > > a < b < c > > But why is it that in C...

Should the webserver add "Content-Type: text/xml header" to the requested XML file?
I've been informed that a webserver sending a XML file is supposed to add "Content-Type: text/xml header". I'm not questioning that infromation but i'm unsure what was ment by it. The XML i get on my screen when i type in the url to it looks as follows. <?xml version="1.0" encoding="UTF-8"?> <tag-uno>uno</tag-uno> <tag-duo>duo</tag-duo> I can't see any line containing "text/xml" but perhaps it's not supposed to show in the requested file. Please advise. -- Regards Konrad Viltersten ---------------...

Can't use "&" character in a text box
I'm trying to use the "&" character in a text box on a form. Want it to read "Back & Forth". Can't seem to make Access accept and show this. When I launch the form, the & character disappears. It reads "Back Forth" I've researched this and tried preceding it with a literal flag \ Didn't work. Any thoughts on how I can enter the "&" symbol so it is displayed in the text box? "&&" If it's default text, try "Back " & "& Forth" "Newsreader" <newsreader@...

Tomcat 5.028 Struts problem
Hi there, I am trying to deploy a war file on Tomcat on Windows XP, and I am having a problem as shown below. This war files deploys fine on Websphere 5.01 on both XP and Linux -- what gives?? Any idea -- please help.. Alex. WARNING: Duplicate name in Manifest: Class-Path Sep 17, 2004 9:13:05 PM org.apache.struts.util.PropertyMessageResources <init> INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true Sep 17, 2004 9:13:05 PM org.apache.struts.util.PropertyMessageResources <init> INFO: Initializing, config='org.apache.struts.action.Act...

"""""""""ADD ME""""""""""
Hi , Hope you are doing great. Please let me take this opportunity to introduce myself, Iam Karthik working with BhanInfoi Inc, a NY based company. We have consultants on our bench on various technologies, my request is to add me to your distribution list and kindly do send me the requirements. i have the below list available 1. Mainframe 2. Java 3.. Financial Analyst 4. Data Architect If there is any vendor ship agreement which has to be signed then I would like to take an opportunity to represent my company and expect your cooperation... ...

Problems with "&amp;" changing to "&"
A lot of Firefox users I know, says they have problems with validation where the ampersand sign has to be written as &amp; to be valid. I don't have Firefox my self and don't wont to install it only because of this, so I hope some of you gurus can enlighten me with this :) In what circumstances can the "&amp;" in the source code be involuntary changed to "&" by a browser when or other software, when editing and uploading the file to the web server? E.g. writing a string like "sc_project=402887&amp;java=0&amp;security" is cha...

Newbie question : Xerces (C++) How do I create the <?xml version="1.0" encoding="UTF-8" ?> header
I have created a XML Writer program, and everything works, but I need to revice my code and add this "version and encoding" header for completeness and correctness... I am completely stuck! I have done this so far: DOM_Element root = xmlDoc.getRootElement(); root.setAttributes ("xmlns","etc.etc."); Do I have to previous root called "?" - but this doesn't make much sense as the tag begins "<?xml" and ends "?>" From scouring the web, I believe that I coding with a legacy version of xerces-c. (hence DOM_Element) I cannot change or update the library Please can I have a snippet of code? Thanks a lot! I hope this reads a bit nicer: Hands moving quicker than brain(!) I have created a XML Writer program, and everything works, but I need to revise my code and add this "version and encoding" header for completeness and correctness... I am completely stuck! I have done this so far: DOM_Element root = xmlDoc.getRootElement(); root.setAttributes ("xmlns","etc.etc."); Do I have to create another previous root called "?" - but this doesn't make much sense as the tag begins "<?xml" and ends "?>" From scouring the web, I believe that I coding with a legacy version of xerces-c. (hence DOM_Element): I cannot change or update the library Please can I have a snippet of code? Thanks a lot! In article <c8225m$nat$1@rdel.co.uk>, m...

VI &quot;FindInstrumentDrivers.vi&quot; was stopped at node &quot;&quot; at a call to &quot;IDF_WsIdOpen.vi&quot;
This what I get trying to download Instrument Drivers in LabVIEW 8.2. LabVIEW 8.6 doesn't succeed either. any ideas? Could just be an intermittent server problem. Does this happen all the time? At what point does it fail? When you first launch it, after you login? The network traffic indicates that it uses port 3339. Is this being blocked by your firewall? ...

Programmatic &quot;undo&quot; for &quot;FitControlToPane&quot; ?
Howdy neighbors!, (using LV8.2)&nbsp; I'm trying to develop a GUI that lets the user toggle a Tab-control between "Full Pane" and a&nbsp;reduced size/position - sorta-like&nbsp;the "Full Screen" option on many Video apps.&nbsp; The effect of the&nbsp;invoke-node method "FitControlToPane" is perfect (- :smileyhappy: -), but how to undo that effect?&nbsp; After&nbsp;FitControlToPane,&nbsp;"Scale Object with Pane" is selected in the IDE, yet I can't find a "property" for it. :smileysad:&nbsp; FitControlT...

How to change &quot;ASRL2:... &quot; to &quot;COM1&quot;?
Dear All, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I have used com port in my vi. And When I run it in edit mode,&nbsp;the selection of com displays "COM1,COM2,LTP1". &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; But when I build it, and run it in another PC, it displays "ASRL2:...". &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; How can I modify my vi to make it display COM1... in another PC? &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; And If I only want to display all serial port such as COM1,...

The "at" character @
Hello I want to have the character @ in my hp. For me it is the char 174. Maybe I miss something at this point... It is not the real @ Anyway: just put a string with the char 174 in it, and then do the "scroll" command: you will get a small r. Very different from what you can see under the "Char" key... An other question: where are the french accents (�,�,�) in hpgcc? When I do a printf or sprintf with some � I get a strange character. I try also to put in sprintf the numerical value for my � (from the char menu of the hp50g). It doesn't work. I am using UTF-8 on my computer, with latin-1 is it better? On 10/19/2010 2:59 AM, Tanguy Brian=E7on wrote: > I want to have the character @ in my hp. For me it > is the char 174. Maybe I miss something at this point... > It is not the real @ > Anyway: just put a string with the char 174 in it, and > then do the "scroll" command: you will get a small r. > Very different from what you can see under the > "Char" key... Character interpretations relate to a "character set" HP48/49/50 mostly follow ISO-8859-1 where it is defined, for characters 32-127 and 160-255, with some exceptions (note that characters 128-159 are not defined in ISO-8859-1) http://htmlhelp.com/reference/charset/latin1.gif Compare character 64 (ascii "at" sign) with character 174 ("Registered" trademark) > Another question: where are the french accents (=E9,=E8,=E2)...

how to connect &quot;IMAQ Get Buffer.vi&quot; output terminal of &quot;Image Out&quot; to the input terminal of &quot;Image&quot; of &quot;IMAQ ColorImageToArray.vi&quot;
Hi, Thanks a lot for helping me till this stage.I am again stuck up with some problem.Please help me this time also. Actually i am making changes in already existingblock diagram and also i am new to this labview programming.And also time is very crucial. So i want to know if there is any way to connect the output of Image out terminal of IMAQ Get Buffer.vi to the input terminal of Image of IMAQ ColorImageToArray.vi. In the actual block diagram the output of Image out terminal of IMAQ GetBuffer.vi is connected to the input terminal of Image of IMAQ ImageToArray.vi. I want to change this becos ...

In xml schema, what's the difference between attribute "final" and "block" in element "element"
That is, what's the difference between <complexType name="Address" final="restriction"> <sequence> <element name="name" type="string"/> <element name="street" type="string"/> <element name="city" type="string"/> </sequence> </complexType> and <complexType name="Address" block="restriction"> <sequence> <element name="name" type="string"/> <element name="street" type="string"/> <element name="city" type="string"/> </sequence> </complexType> in xml schema? Hi, You can think of final as a development time restriction (applies to schema itself) and of block as a runtime restriction (applies to schema usage from the instance documents). If you have final="restriction" (note that I made city optional to have something to restrict) <xs:complexType name="Address" final="restriction"> <xs:sequence> <xs:element name="name" type="xs:string"/> <xs:element name="street" type="xs:string"/> <xs:element name="city" type="xs:string" minOccurs="0"/> </xs:sequence> </xs:complexType> then trying to create a type like below will fail with a...

Problem with "&" charater in xml.
i have walked a directory and have written the foll xml document. one of the folder had "&" character so i replaced it by "&amp;" #------------------test1.xml <Directory> <dirname>C:\Documents and Settings\Administrator\Desktop\1\bye w&amp;y </dirname> <file> <name>def.txt</name> <time>200607130417</time> </file> </Directory> <Directory> <dirname>C:\Documents and Settings\Administrator\Desktop\1\hii wx</dirname> <file> <name>abc.txt</name> <time...

Web resources about - Character reference "&#c" is an invalid XML character - comp.text.xml

Resources last updated: 3/14/2016 1:46:55 AM