Re: XMLReader skip current element
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Tue, 5 Jun 2007 20:47:18 +0100
Peter Duniho <NpOeStPeAdM@xxxxxxxxxxxxxxxx> wrote:
Is there any real reason why you need to handle an invalid XML file?
Most XML-based applications don't, as far as I'm aware. (Obviously XML
editors have to, but other than that...)
Well, and in fact I'm not sure that XML editors have to either. As an
imprecise but similar example, consider Visual Studio's code editor. If
you miss some sort of closing quote, comment closure, closing bracket,
etc. the editor makes no attempt to recover from that. It just shows you
that there's a problem, treating the file as "valid" all the way up to the
point where it knows for sure it's not valid (which is often the end of
the file).
It depends on quite how broken you make it.
If you miss off a semi-colon or have a random extra character like "+"
between statements, it's still syntactically invalid, but it recovers
quickly. An extra closing brace certainly confuses it though, yes.
I can imagine someone writing an XML editor that goes to a lot of effort
to try to detect and correct invalid XML, just as the OP wants to do in
his program. But it would surprise me if this is the norm, even when
looking only at XML editors.
Maybe it's just the ones I've used - and that's only from memory,
admittedly...
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.
- Follow-Ups:
- Re: XMLReader skip current element
- From: Peter Duniho
- Re: XMLReader skip current element
- References:
- XMLReader skip current element
- From: Alex
- Re: XMLReader skip current element
- From: Jon Skeet [C# MVP]
- Re: XMLReader skip current element
- From: Alex
- Re: XMLReader skip current element
- From: Jon Skeet [C# MVP]
- Re: XMLReader skip current element
- From: Peter Duniho
- XMLReader skip current element
- Prev by Date: Re: Deriving from forms
- Next by Date: Re: static class inheritance, generalized
- Previous by thread: Re: XMLReader skip current element
- Next by thread: Re: XMLReader skip current element
- Index(es):
Relevant Pages
|