Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

xml

Can anyone please tell me how to solve the following XML Exception?

Character reference &#x1F is an invalid XML character

I have a XML file with the character &#x1F, When I try to parse this XML file I'm getting this Exception. Is there any way to resolve this?

The part of my code is like this...

File f = new File("sample.xml");
dom = db.parse(f);

I'm getting exception when I'm calling the function parse(). I also tried with UTF8 encoding, and got the same exception.

Any help is much appreciated.

Thank u in advance!!!

like image 224
perumal Avatar asked May 03 '11 12:05

perumal


1 Answers

As Michael Kay commented: There are more valid characters in XML 1.1 than in XML 1.0. In case the XML has a prolog that declares version 1.0 it might be sufficient to change the prolog from

<?xml version="1.0" >

to

<?xml version="1.1" >

If there are still invalid characters, you must decide how to deal with them. Streamflyer will ease your task.

like image 180
rwitzel Avatar answered Oct 04 '22 03:10

rwitzel