• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

An invalid XML character (Unicode: 0x13) was found in the element content of the document.

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I've been struggling with this for days, I've searched these forums(and google), and found some other people with the same problem but no fix. The bad character is an "en-dash", unicode character 8211. My legacy data also has some other bad characters, but I'm hoping if I can solve this one, I can get the others.


The error happens when trying to send the xml over web services.
Here are the examples I put together using junit.



The results from running this are:




Any help would be much appreciated, I believe this character to be in the valid xml range. Even escaping the character & # 8211(remove spaces) results in it not being properly read on the other end.

Thanks!
Bill
 
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
did you try static String badChar = "\u2013"; ?
 
Bill Ramsey
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for responding! No change when I set it to "\u2013"

I'm trying to move over legacy data, so I need to be able to escape or remove this data in a large number of entries.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If this was my problem I would be extracting the line and column number of the bad character from the SAXParseException to be absolutely certain that the source is the String you are testing.

See also this recent topic.

Bill
 
What is that? Is that a mongol hoarde? Can we fend them off with this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic