Re: Parse failure reports

For what it’s worth (not necessarily what you paid for it) I lean 
toward the second approach, with markup for the different 
pieces of information because that makes it easy for other 
tools to do things with the information (even if it’s just showing
the information to the user in a different format).

On a tangential note, I would also be inclined to render the 
position in the input something like

  <input-line>a <here-is-where-it-broke/>b</input-line>

just because putting a caret on the next line works only
for non-proportional fonts.

Also, unless we decide to define elements for such reports
in the spec (no, we shouldn’t, and I’m not proposing it),
your report should probably be in a namespace owned by you 
and used for your processor, rather than in the ixml namespace.
So 

   <seip:report …>
   </

(here seip stands, of course, for Steven’s Excellent ixml Parser).

I need to update Aparecium to put that ixml:state=‘failed’ on
the ’no-parse’ element I use.

Michael


> On 13,Nov2021, at 2:36 PM, Steven Pemberton <steven.pemberton@cwi.nl> wrote:
> 
> Currently my implementation reports a parse failure like this:
> 
>  *** Parsing failed at line 1, position 2
>  a b.
>   ^
>  *** Permitted at this position: [",.;:'?!"].
> 
> but the spec says
> 
> "If the parse fails, some XML document must be produced with ixml:state="failed" on the document element. The document should provide helpful information about where and why it failed; it may be a partial parse tree that includes parts of the parse that succeeded."
> 
> Any opinions on how suitably to return this information?
> 
> <report  ixml:state="failed" xmlns="https://invisiblexml.org/NS" xmlns:ixml="https://invisiblexml.org/NS">
> *** Parsing failed at line 1, position 2
>  a b.
>  
> 
>  ^
> *** Permitted at this position: [",.;:'?!"].
> </report>
> 
> <report  ixml:state="failed" xmlns="https://invisiblexml.org/NS" xmlns:ixml="https://invisiblexml.org/NS">
>    <message position="line 1, position 2">Parsing failed</message>
>    <line>a b.</line>
>    <pos> ^</pos>
>    <message>Permitted at this position: [",.;:'?!"].</message>
> </report>
> 
> Steven
> 

Received on Sunday, 14 November 2021 00:39:54 UTC