[Expat-discuss] DTD validation

Karl Waclawek karl at waclawek.net
Tue Jun 24 14:17:55 EDT 2003


> Hi Karl,
> What's the basic approach you would use to build DTD validation on top of
> Expat? I've built a VoiceXML interpreter using expat and just use the most
> basic features, start/end element and character data handlers. Would you
> parse the DTD and create some sort of schema or object model? Is there some
> way to cause expat to use it or do you just call the validation in the
> element handler?

There are likely many ways.

I am just about to finish a DTD validator in Delphi (based on SAX2 events),
with Expat as the underlying parser. In my case I opted to create
a schema object model (basically, one node per element type, and a tree
of "content particle" nodes for each element type with element content).
My main reason (except validation) was to have a way to attach event handlers 
on a more granular basis - that is, it allows me to register an event handler 
for an element type. This allows me to organize my code in a more convenient fashion.

There might be more to find on our links page.

I also know that Rolf Ade wrote a DTD validator for Tcl, based on Expat.
You might want to have a look at that one too. http://www.tdom.org .

Karl



More information about the Expat-discuss mailing list