Rebelling parser writers (Was: ]]> within a CDATA marked section ?)

Richard Light richard at light.demon.co.uk
Fri Nov 28 07:55:34 GMT 1997


In message <01BCFB68.64DAE950 at xyplex34.uio.no>, Jarle Stabell
<jarle.stabell at dokpro.uio.no> writes

>After attempting to process a document containing errors, I want to present to 
>the user a list of error messages, and when the user clicks on one of these 
>messages, I want to highlight the exact part of the document where the error 
>occurs.
>The problem with entity expansion is that the parser isn't parsing what the 
user 
>literally wrote into the entity definitions, it is parsing a 
processed/"virtual" 
>version, which *may* not be a real subpart of the document, so one has to map 
>"virtual" locations/positions to physical (real document) positions, which 
>doesn't seem trivial to me. It is also likely to give slightly confusing error 
>messages, as it may be mentioning expanded stuff ("<xxx>") which the user never 
>wrote, the user may have written "&lt;xxx&gt;" etc.

I don't think this is as much of a problem as you fear.  Every entity is
physically declared somewhere in a real source - usually a good ol' file
on disc.  Of course, that file may not be the one you started from ...

My RunSP program (http://www.light.demon.co.uk/runsp) does exactly what
you describe (for nsgmls).  It runs it under Windows and then allows the
user to navigate from one error message to the next, in a simple editor
environment that lets them sort out the problems they find.  All I did
was to parse the error messages, pick out file name, line number and
character offset, and place a bookmark at the relevant point in the file
concerned.  This works equally well for errors in the DTD or SGML
Declaration as for those in what we think of as the 'real document'.
(Which is something that never occurred to me when designing RunSP - but
of course the Declaration and DTD are equally part of the document as
far as the parser is concerned.)

Richard Light.

Richard Light
SGML/XML and Museum Information Consultancy
richard at light.demon.co.uk

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list