Reputation: 9765
ErrorrAn invalid XML character (Unicode: 0xb) was found in the element content of the document.
I get this error when i am trying to parse an xml data using dom parser ?
What is the reason ?
How can i solve this problem ?
EDIT Here is the XML file snippet
<CIRS><CIR applicantId="131906564" loanId="126907905" applicantRefId="TSFI012095G1" fan="TSFI012095"><REQUESTDATA><NAME>D DUNSTON JOSEPH WILFRED</NAME><DOB>31-07-1966</DOB><GENDER>Male</GENDER><ID><TYPE>PASSPORT NUMBER</TYPE><VALUE>H3359853</VALUE></ID><ID><TYPE>DRIVER'S LICENSE NUMBER</TYPE><VALUE>R/TN/69/005545/2005</VALUE></ID><PHONE>95412563#25,23778#34,87976#54</PHONE>
I guess the problem is in phone number tag <PHONE>95412563#25,23778#34,87976#54</PHONE>
Upvotes: 1
Views: 10985
Reputation: 200
Whenever invalid xml characters are entered into xml, it gives such an error. When you open it in Notepad++ it looks like VT, SOH, FF. These are invalid xml characters. I'm using xml version 1.0 and I validate text data before entering it in database by using the following pattern:
Pattern p = Pattern.compile("[^\\u0009\\u000A\\u000D\u0020-\\uD7FF\\uE000-\\uFFFD\\u10000-\\u10FFF]+");
retunContent = p.matcher(retunContent).replaceAll("");
It will ensure that no invalid special character(s) will enter in xml.
Upvotes: 4