473,396 Members | 1,921 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,396 software developers and data experts.

How to handle XML parsing exception

Dear Members

When I tried to navigate in an XML file, an exception occurred :
"An error occurred while parsing XML file".

I want to ignore the case (line(s)) which caused the exception and
continue navigating, but unfortunately xmlreader.Read() does not work.
It seems that the xmlreader object hangs. How can I overcome this bug?

Thanks in advance
Aug 7 '08 #1
4 5479
On Aug 7, 2:10*pm, AliRezaGoogle <asemoo...@yahoo.comwrote:
When I tried to navigate in an XML file, an exception occurred :
"An error occurred while parsing XML file".

I want to ignore the case (line(s)) which caused the exception and
continue navigating, but unfortunately xmlreader.Read() does not work.
It seems that the xmlreader object hangs. How can I overcome this bug?
As far as I'm aware, you can't - malformed XML is basically fatal to
XML parsers which aren't designed to compensate (e.g. for text
editors).

Is there any reason you can't fix the XML first instead?

Jon
Aug 7 '08 #2
How can I overcome this bug?

It sounds like the "bug" is your malformed xml. Fix your pseudo-xml.

Marc
Aug 7 '08 #3
MC
It sounds like the "bug" is your malformed xml. Fix your pseudo-xml.

But his request is reasonable. Corrupted XML files do occur. The syntax of
XML should make it possible to recover (partly) from minor corruption, e.g.,
change

<blither><blah>asdfasdf</blaaaaah><blah>qwertyuiop</blah></blither>

into

<blither><blah>qwertyuiop</blah></blither>
(omitting the malformed section)

or even

<blither><blah>asdfasdf</blah><blah>qwertyuiop</blah></blither>
(correcting the incorrect terminator).

So who will invent a syntax-error-tolerant XML parser?
Aug 7 '08 #4
On Aug 7, 2:47*pm, "MC" <for.address.l...@www.ai.uga.edu.slash.mc>
wrote:
It sounds like the "bug" is your malformed xml. Fix your pseudo-xml.

But his request is reasonable. *Corrupted XML files do occur.
Indeed, and the data in them shouldn't be trusted.
The syntax of XML should make it possible to recover (partly) from minor corruption, e.g.,
change

<blither><blah>asdfasdf</blaaaaah><blah>qwertyuiop</blah></blither>

into

<blither><blah>qwertyuiop</blah></blither>
(omitting the malformed section)
Except there are any number of alternative ways of "recovering" from
the error, and no way of knowing which one is "correct".

XML was specifically designed to be error intolerant, partly to avoid
all the error recovery which has plagued browsers.
or even

<blither><blah>asdfasdf</blah><blah>qwertyuiop</blah></blither>
(correcting the incorrect terminator).

So who will invent a syntax-error-tolerant XML parser?
They must exist for text editors etc - but I wouldn't want to use one
for anything where the XML is being actually processed instead of just
displayed to a user.

Jon
Aug 7 '08 #5

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

Similar topics

1
by: de_subhadeep | last post by:
Hi All, My program is running on a headless mode and I need to set the look and feel of my program but it gives me Headless Exception when I try to set the look and feel. The exception is as...
1
by: Abelardo Vacca | last post by:
Hello, I am currently in the process of switching our application to a N-Tier model with .NET. One of the aspects we want ot get right from the start not to worry about it after is the...
2
by: NITIN MUNJAL | last post by:
hello, i am facing a problem in the runtime. this code is throwing exception details of which are writtten below that CODE string strConn=@"Provider=Microsoft.Jet.OLEDB.4.0 ;Data Source=" +...
1
by: Jake Barnes | last post by:
I can not figure out the meaning of this error: Error: " nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame :: http://www.bluecasts.com/pdsIncludes/pdsAjax.js ::...
1
by: metsys | last post by:
We have an ASP.NET 2.0 (C#) application that is divided into multiple layers. The multiple layers come from having a web project and 2 different class library projects in the same solution. I'm...
6
by: Liming | last post by:
Hi, In a typical 3 tier model (view layer, busines layer and data access layer) where do you handle your exceptions? do you let it buble up all the way to the .aspx pages or do you handle it in...
1
by: jayapal | last post by:
Hi , I am using the NEW operator to allocate the memory in many places of my code.But I am not doing any error hadling or exception handling.Can any one suggests me how to do exception handling,...
5
by: George2 | last post by:
Hello everyone, I am learning set_se_translator, and there are some good resources about how to translate structured exception into C++ exception, like, ...
2
by: rvarshney | last post by:
Hi All, Sometimes my application crashes with the exception Exception type: System.ComponentModel.Win32Exception Message: Error creating window handle. My Question to you guys are: 1. I am...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.