473,218 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,218 software developers and data experts.

How to detect the Invalid XML Character ?

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

Jun 12 '06 #1
2 3481
sa********@gmail.com 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/
Jun 12 '06 #2
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
Jun 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: R. Rajesh Jeba Anbiah | last post by:
Here is a nice code to detect utf-8 <http://in2.php.net/utf8_encode#39986> But, I couldn't find out the logic behind the script. If anyone knows that please share. Particularly I would like to...
9
by: Safalra | last post by:
The idea here is relatively simple: a java program (I'm using JDK1.4 if that makes a difference) that loads an HTML file, removes invalid characters (or replaces them in the case of common ones...
1
by: Roy | last post by:
Hi, I have a problem that I have been working with for a while. I need to be able from server side (asp.net) to detect that the file i'm streaming down to the client is saved...
13
by: Michal | last post by:
Hello, is there any way how to detect string encoding in Python? I need to proccess several files. Each of them could be encoded in different charset (iso-8859-2, cp1250, etc). I want to detect...
0
by: Robert Boone | last post by:
Is there any way to detect the real character set use in columns? I've just seen a mysql 4.0 database where the default character set was latin1 but greek was being inserted. When that database was...
6
by: rrs.matrix | last post by:
hi i have to detect the type of CPU. whether it is 32-bit or 64-bit.. how can this be done.. can anyone please help me.. thanks.
20
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I detect Opera/Netscape/IE? ----------------------------------------------------------------------- The...
2
by: lawrence k | last post by:
2 years ago I asked, on this newsgroup, how to weed out non-UTF-8 characters from my RSS feed. I was told that I could not do so with certainty, but I could try various tricks that would give me...
7
by: Peter | last post by:
Hello I have an UTF string, how can i detect what language it is? thanks from Peter (cmk128@hotmail.com)
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.