[xsl] Anyone knows of an autocompleting SAX parser or filter?

Subject: [xsl] Anyone knows of an autocompleting SAX parser or filter?
From: Gunther Schadow <gunther@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 05 Mar 2003 12:29:30 -0500
Hi,

sometimes I transform large files and it takes long. What I then do
is to take a snapshot of the XML output and load it into a text
editor, cut incomplete tails off at a suitable point and then close
all open tags. Then I can forward this file to other transforms.

Wouldn't it be nice if one could tell the SAX Parser (i.e. aelfred)
that instead of throwing all hands up if the file ends prematurely,
close all open tags and finish the file gracefully? Is there
such a thing?

Since I am a disciple of Aelfred and Saxon I am most interested in
a generic solution (not one that would ask me to migrate so some
other parser). I could imagine a little SAX filter that would
receive events from an upstream parser and keep a simple stack of
open elements. Then if it receives a SAXParserException from the
upstream parser, it will simply pop the elements to close from the
stack and produce endElement events from those.

Simple enough that I will eventually just do it. But has anybody
done it already?

thanks,
-Gunther

PS: and no, I do not care whether the result document conforms to
some schema or whether there may be broken forward references in
the data. All I want is a well-formed output.

--
Gunther Schadow, M.D., Ph.D.                    gschadow@xxxxxxxxxxxxxxx
Medical Information Scientist      Regenstrief Institute for Health Care
Adjunct Assistant Professor        Indiana University School of Medicine
tel:1(317)630-7960                         http://aurora.regenstrief.org



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Current Thread