Re: XMLReader skip current element

Tech-Archive recommends: Fix windows errors by optimizing your registry



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
.



Relevant Pages

  • Re: XML Style Sheet Designer
    ... >> sheets but FrontPage can be used to view and test result by loading the ... The XSL can be manually written in the FrontPage editor ... >> XML" as any well formed XML file can be read by dragging it into the body ... there are a number of XML and XSL editors around. ...
    (microsoft.public.frontpage.programming)
  • Re: XML Style Sheet Designer
    ... > sheets but FrontPage can be used to view and test result by loading the ... The XSL can be manually written in the FrontPage editor ... > XML" as any well formed XML file can be read by dragging it into the body ... there are a number of XML and XSL editors around. ...
    (microsoft.public.frontpage.programming)
  • Re: XMLReader skip current element
    ... Most XML-based applications don't, ... and in fact I'm not sure that XML editors have to either. ... If you miss some sort of closing quote, comment closure, closing bracket, etc. the editor makes no attempt to recover from that. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: XML Not good for Big Files (vs Flat Files)
    ... XML and the comms sees a small file. ... Hmm, I'd say it's more like having two tools, each one doing what it does very well (XML to represent tree-structured data, gzip to compress arbitrary data), rather than one tool that does both semi-weill. ... Well, nothing stops people from mucking around with ASN.1 files using hex editors, or hell, even plain ASCII text editors if they wanted to. ...
    (comp.lang.java.programmer)
  • Re: [PHP] What is "white space"
    ... Command Line editors used. ... Currently all these editors add what appears to be a \n after a closing ?> ... Some dummy code -> ...
    (php.general)