Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes  An invalid XML character (Unicode: 0x0) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark " An invalid XML character (Unicode: 0x0)" Watch " An invalid XML character (Unicode: 0x0)" New topic
Author

An invalid XML character (Unicode: 0x0)

bob connolly
Ranch Hand

Joined: Mar 10, 2004
Posts: 204
Hello!

I'm trying to figure out how to indentify this (0x0 Unicode) character when i encounter it please!

I'm reading a pipe delimited file, parsing it into an array and creating XML and it looks like there is this hidden character at the end of one of the records!

fatalError:
setValidity:
Error number : 1
Error starts on line number : 424
Error starts on column position: 320
Error text is : org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x0) was found in the element conte
nt of the document.
HlpValPipBufXml2/Error9/creating SAX parser: org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x0) was found in the e
lement content of the document.

Here is where i'm assigning the data to a token and if i could check the array element characters with something like:

j=sa[i].indexOf("0x0");
if (j>0) sa[i].charAt(j)=' ';



Thanks very much!
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
Unicode: 0x0 is 'null'
What if you test for null in your input and ignore it when found.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
bob connolly
Ranch Hand

Joined: Mar 10, 2004
Posts: 204
Oh that's the NULL symbol!

Thanks Marylin!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: An invalid XML character (Unicode: 0x0)