[Expat-discuss] DTD validation

Chris Cross xcross at us.ibm.com
Tue Jun 24 15:52:07 EDT 2003





So how does one parse a DTD? I see to call XML_SetParamEntityParsing. Are
there API's to help expand the entities or do you have to just roll your
own with start/end element handler? Is there a simple example of parsing
DTD's (like outline.c ?)

thanks,
chris


Chris Cross
IBM Boca Raton
xcross at us.ibm.com
voice 561.862.2102  t/l 975.2102
fax 561.862.3922



                                                                                                                                                    
                      "Karl Waclawek"                                                                                                               
                      <karl at waclawek.ne        To:       <expat-discuss at libexpat.org>, Chris Cross/West Palm Beach/IBM at IBMUS                        
                      t>                       cc:                                                                                                  
                                               Subject:  Re: [Expat-discuss] DTD validation                                                         
                      06/24/2003 01:17                                                                                                              
                      PM                                                                                                                            
                                                                                                                                                    
                                                                                                                                                    




> 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