Re: XMLReader skip current element



On Tue, 05 Jun 2007 13:40:01 -0700, Jon Skeet [C# MVP] <skeet@xxxxxxxxx> 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.

[...] 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).

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.

Pete
.



Relevant Pages

  • A language-agnostic language
    ... using Java 1.4 and 1.5, let alone between Java and C++, I'd have ... in XML. ... have the editor display the code as Java. ... update the code as Java, and compile it, and run the byte-code. ...
    (comp.lang.java.programmer)
  • 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, ... just how handy would it be to just skip over an invalid ... Just because the remaining XML can be parsed, ... should try to recover. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: MFC, XML, C++ .NET Help.....
    ... parse your XML and still compile native. ... The application scraps a single small xml string from ... I want to parse this xml string out to be used in the ...
    (microsoft.public.vc.mfc)