Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] Shemp: an XMLFilter for use with XOM

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: John Cowan <jcowan AT reutershealth.com>
  • To: xom-interest AT lists.ibiblio.org (Xom Interest)
  • Subject: [XOM-interest] Shemp: an XMLFilter for use with XOM
  • Date: Mon, 23 Sep 2002 16:56:43 -0400 (EDT)

Shemp is a concept (which should be very easy to code up) loosely based
on Simon St. Laurent's MOE (http://moe.sourceforge.net), but using SAX
and XOM instead of something special-purpose. I will sketch it here
and lazily let someone else fill in the details:

Shemp is an XMLFilter, so you wrap it around some existing SAX parser.
Normally, it just does what XMLFilterImpl does: it passes through each
event from the wrapped parser to its client. But during a startElement
event, the client can invoke Shemp's constructElement method. This sets
an internal flag such that Shemp absorbs all events and manufactures
XOM nodes starting with an Element node until the matching endElement
event is seen. This event within it is then passed to the client,
who can invoke getElement to retrieve the XOM tree that Shemp has built.

Shemp allows XOM to be used for documents that are too large to represent
as a single xom.Document tree. As soon as a suitable local root element
is found, invoking constructElement will create a small XOM tree which
can be passed from endElement to a XOM-aware portion of the program that
can process it. This would be useful, for example, for processing log
files: only a single log entry would need to be in memory at one time,
not the whole file.

--
Business before pleasure, if not too bloomering long before.
--Nicholas van Rijn
John Cowan <jcowan AT reutershealth.com>
http://www.ccil.org/~cowan
http://www.reutershealth.com




Archive powered by MHonArc 2.6.24.

Top of Page