[fpc-pascal] sax.pp

Tony Pelton tpelton at gmail.com
Tue Dec 27 21:14:23 CET 2005


hi all,

i'm a pascal noob, but not a new programmer.

i've done a fair bit of XML parser work in Java.

i was trying to figure out how to do parsing with SAX in pascal last night.

i'm very confused.

in java there are basically three steps to doing SAX parsing :

1) subclass a "handler" and override the methods for the parsing
events you want to trap, such as "begin element".

2) create an instance of the XML parser, and pass an instance of your
"handler" to it.

3) pass in an XML document to the parser and tell it to parse.

your handler then gets callbacks from the parser with data from the
xml document.

in looking at sax.pp in the 'fcl' for free pascal ... i got confused.

for one thing, i don't see any code in the source file that looks like
it is actually doing any parsing ?

i expected to see a bunch of code in there somewhere that was doing a
bunch of string comparison and manipulations at the character level,
like and parser would have to.

maybe there is other code that i haven't looked at that fills in some
of the gaps ?

second, for hoots and hollers, i subclassed/extended the SAXFilter
class ... thinking that it looked like the descendent of everything
else, thinking that it was itself the parser and handler, and tried to
override some of the callback functions ... but when i call parse on
it, i get an error about abstract methods.

i'm lost.

help ?

documentation ? sample code ?

Tony



More information about the fpc-pascal mailing list