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

Discussion in 'XML' started by cgbusch, Jul 17, 2003.

  1. cgbusch

    cgbusch Guest

    "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
     
    cgbusch, Jul 17, 2003
    #1
    1. Advertising

  2. In article <>,
    cgbusch <> 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!
     
    Richard Tobin, Jul 17, 2003
    #2
    1. Advertising

  3. cgbusch

    Bob Foster Guest

    base64, hex.

    XML doesn't allow arbitrary characters.

    Bob

    "cgbusch" <> wrote in message
    news:...
    > "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
     
    Bob Foster, Jul 17, 2003
    #3
  4. cgbusch

    cgbusch Guest

    "Bob Foster" <> 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.
     
    cgbusch, Jul 17, 2003
    #4
  5. "cgbusch" <> schrieb im Newsbeitrag
    news:...
    > "Bob Foster" <> 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.
     
    Julian F. Reschke, Jul 17, 2003
    #5
  6. cgbusch

    Bob Foster Guest

    "cgbusch" <> wrote in message
    news:...
    > "Bob Foster" <> 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
     
    Bob Foster, Jul 21, 2003
    #6
  7. cgbusch

    Mike Brown Guest

    "Richard Tobin" <> wrote in message
    news:bf6e1t$2lt8$...
    > In article <>,
    > cgbusch <> 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.
     
    Mike Brown, Sep 2, 2003
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark

    Invalid XML character

    Mark, Aug 18, 2004, in forum: XML
    Replies:
    5
    Views:
    5,738
    Richard Tobin
    Aug 18, 2004
  2. Kaidi
    Replies:
    3
    Views:
    6,030
    Kaidi
    Sep 27, 2004
  3. Marco Montel

    invalid XML character

    Marco Montel, Dec 7, 2004, in forum: XML
    Replies:
    6
    Views:
    10,726
    David Carlisle
    Dec 8, 2004
  4. kevin
    Replies:
    0
    Views:
    1,036
    kevin
    Jan 16, 2008
  5. Dan McCloud

    Invalid character in string reference

    Dan McCloud, May 26, 2004, in forum: Javascript
    Replies:
    2
    Views:
    159
    Ivan Marsh
    May 26, 2004
Loading...

Share This Page