xsl-list
[Top] [All Lists]

RE: Anyone knows of an autocompleting SAX parser or filter?

2003-03-05 13:00:17
I think a good way of doing this would be to write an STX transform as a
preprocessing filter to the XSLT transform. STX is described at
stx.sourceforge.net. It is an XSLT-like transformation language that
processes a SAX stream serially, without building a tree. It is
therefore very suitable for writing a filter that reduces the size of
the tree that XSLT has to deal with.

Michael Kay

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Gunther Schadow
Sent: 05 March 2003 17:30
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Anyone knows of an autocompleting SAX parser or filter?


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(_at_)regenstrief(_dot_)org
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



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



<Prev in Thread] Current Thread [Next in Thread>