Re: SSAX seeds help (and parse problems with entities)

[email protected] Sat, 6 Jan 2007 05:03:44 -0800 (PST)
Newsgroups gmane.lisp.scheme.ssax-sxml
Message-ID <[email protected]>
Hello!

Tobias Gerdin wrote:
> So, to some it up: How do I extract CDATA sections from arbitrary  
> tags in a nice way?

	Please see the file ssax-extraction.scm that has just been
added to SSAX/examples
 http://ssax.cvs.sourceforge.net/ssax/SSAX/examples/ssax-extraction.scm
It is tested with Petite Chex Scheme. The code requires a Scheme
system that distinguishes between #f and '().

The file is meant to show off SSAX-like parsing with extracting
content only of a few desired elements. The content of disregarded
elements is not saved in any form, even temporarily. The whole
document is processed as it is being read. It is thus possible to
efficiently handle very large XML documents.

The example is also meant to be representative of your task. The code
uses the sample JMDict XML document that was given on the
j_jmdict.html page (after fixing a few errors in the latter document
and extending it a bit).

The process of deriving a custom SSAX parser is simple: we take 
ssax:xml->sxml code and modify it a little bit. SSAX was specifically
meant to be instantiated for various custom parsing schemes; that's
why it's a macro.

The code ssax-extraction.scm specifically has `debug printing' left
in, to print out the seed and the element names as we enter and leave
XML elements. The trace should make it clear how the seed propagates
as the parsing progresses.

	Cheers,
	Oleg


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV