Re: XMLReader skip current element



Peter Duniho <NpOeStPeAdM@xxxxxxxxxxxxxxxx> wrote:
[...]
You should try Eclipse some time - it will compile (in some cases, at
least) syntactically invalid code, generating code which throws an
exception when it's got to somewhere that the compilation broke. Not
terribly handy, but quite cute.

Well, sure. I can appreciate "cute". :) But as you say, not terribly
handy. Likewise, just how handy would it be to just skip over an invalid
section of XML, when you have no idea what the overall effect of doing so
would be? Just because the remaining XML can be parsed, that doesn't mean
that it can be *used* without the part that was erroneous.

On the other hand, if I open an invalid XML file it's nice to know
whether there's just one error or whether the whole thing is pooched.

[...] Certainly the VS
2005 XML editor was able to automatically close the "blech" tag in the
below XML, despite the previous error:

I certainly agree that it *can* be done. I just am not convinced it makes
sense to bother writing the code to do so. It does seem to me that in an
editor, where the user is actively modifying the data, it makes more sense
to put the effort in, but even there I wouldn't necessarily insist on it
(even in VS there are limits to what it can recover from, and frankly it
only handles the simplest situations). I expect it's something you see in
editors that are intended to be feature-laden, considered "heavy-duty"
(that's certainly how I'd describe VS).

Agreed in the last bit - and I'm *certainly* not suggesting that the OP
should try to recover.

In a situation where the data is static though, I don't see the use in
recovering. You never know when the data that was in error was critical
to the use of the larger XML document. Just because you can successfully
parse the rest of the document doesn't mean you should, just as just
because a compiler could make an assumption about where to insert a
missing semi-colon doesn't mean it should.

Oh absolutely. I was only talking about editors, where it can be handy
to be able to show more than the first error.

Even with static document reading, it *may* be useful to bomb out with
an error which has a good stab at working out where all the error parts
are, rather than just the first one. That's not the same as really
trying to recover though.

--
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
.



Relevant Pages

  • Re: Recompiling invalid objects in PL/SQL
    ... Many organizations monitor invalid objects in important application ... -- Stores PL/SQL program units that failed compiled TYPE lv_invalid_tab IS TABLE OF cur_objects_invalid%ROWTYPE INDEX BY BINARY_INTEGER; ... EXISTSTHEN -- Builds COMPILE DDL statements IF cur_objects_invalid_rec.object_type = 'PACKAGE BODY' THEN ...
    (comp.databases.oracle.server)
  • Re: Nervous Nuby Starting Out!
    ... i use because my boyfriend pointed out that XML works well as a Better ... try to compile and install Gems so I can have a go at using the ... at Ruby In The First Place is to take a step back and learn from the ... future if I keep learning Applescript as self-taught with nobody to talk to. ...
    (comp.lang.ruby)
  • Re: XML-based object orientated pre-Assembler
    ... > I have been promising an object orientated ASM IDE for a while now. ... > that will parse XML code and output ASM files. ... > compile and viola, the code is ported. ... "Why would someone use this product over other assemblers?" ...
    (alt.lang.asm)
  • Re: XMLReader skip current element
    ... You should try Eclipse some time - it will compile (in some cases, ... Likewise, just how handy would it be to just skip over an invalid section of XML, when you have no idea what the overall effect of doing so would be? ... It does seem to me that in an editor, where the user is actively modifying the data, it makes more sense to put the effort in, but even there I wouldn't necessarily insist on it. ...
    (microsoft.public.dotnet.languages.csharp)
  • Does anyone meet problem on snull code (LDD3)?
    ... to compile at 2.6.24.3 kernel, ... SIOCSIFFLAGS: Invalid argument ...
    (comp.os.linux.development.system)

Loading