Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > How to detect the Invalid XML Character ?

Reply
Thread Tools

How to detect the Invalid XML Character ?

 
 
sachinik19@gmail.com
Guest
Posts: n/a
 
      06-12-2006
Hi,

We are using SAXParser (xerces) for parsing an xml with utf-8 encoding.
For some special character it gives SAXException with error message -
"The invalid character is found in the document ". But for other errors
also it gives the same Exception only with different message.
Is there any way to detect that the error is because of the invalid
character in xml ?

Or

if there is any profile to check whether the xml contains any invalid
character or not??

thanks in advance

sachin

 
Reply With Quote
 
 
 
 
Peter Flynn
Guest
Posts: n/a
 
      06-12-2006
wrote:
> Hi,
>
> We are using SAXParser (xerces) for parsing an xml with utf-8 encoding.
> For some special character it gives SAXException with error message -
> "The invalid character is found in the document ". But for other errors
> also it gives the same Exception only with different message.
> Is there any way to detect that the error is because of the invalid
> character in xml ?


Run a standalone parser that gives you line number and character number,
eg onsgmls, rxp, etc.

///Peter
--
XML FAQ: http://xml.silmaril.ie/
 
Reply With Quote
 
 
 
 
Joe Kesselman
Guest
Posts: n/a
 
      06-13-2006
Peter Flynn wrote:
>> Is there any way to detect that the error is because of the invalid
>> character in xml ?


Unfortunately, SAXExceptions don't carry any sort of standard code to
describe the failure. Check your specific parser implementation; it
_might_ have added this information... but that will be a nonportable
solution, if so.

Simplest answer may in fact be to implement your own parser which does
present that information, or to get hold of an open-source parser like
Xerces and add this feature to it. Again, the problem is that this isn't
portable to other parsers unless they have the same tweak.



--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
invalid character in base-64 string and invalid postback or callba kevin ASP .Net 0 01-16-2008 09:39 PM
this code: &#x3, an invalid XML character error. Kaidi XML 3 09-27-2004 03:51 PM
Invalid XML character Mark XML 5 08-18-2004 01:57 PM
Character reference "&#c" is an invalid XML character cgbusch XML 6 09-02-2003 07:04 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57