Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

reproducing An invalid XML character (Unicode: 0x0)

 
Kaushik Baral
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am receiving the below mentioned error in my xsl.
"An invalid XML character (Unicode: 0x0) was found in the element content of the document."

Not very sure why i am getting it. i found some posts on internet saying its because of some NULL value, some said its problem with the parser. but i want to know the actual problem and from where its coming. i have received this error in my prod. environment and i am trying to reproduce the issue but not able to do the same. could some one please tell me how can i get the same error again.

thanks a lot in advance.
 
Richard Tookey
Bartender
Posts: 1166
17
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the XML is UTF-32BE or UTF-32LE encoded and includes a BOM then it could account for the problem since UTF-32BE has a BOM of 0x00, 0x00, 0xFE, 0xFF and UTF-32LE has a BOM of 0xFF, 0xFE, 0x00, 0x00. You need to use a HEX editor on the offending file content to see exactly where the character code of zero appears.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Parsing the source as an XML document should cause a SAXParseException. Catch that and you can extract the line and column number from the parse exception.

Most of my illegal character problems have been due to text edited with MS Word - especially those "smart punctuation" characters.

I use UltraEdit-32 for fiddling with hex characters - not free but very very useful. You could use a hex editor to insert any character you want.

Bill
 
Paul Clapham
Sheriff
Posts: 21316
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As for how to reproduce the issue: since the problem is that the XML document you tried to parse contains a character which isn't valid according to the rules of XML, you should just try to parse that same document over again.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic