[Insight-developers] XML Library Stuff
Brad King
brad . king at kitware . com
Thu, 3 Jul 2003 13:36:45 -0400 (EDT)
> 2. The basic mechanism for reading/writing out datafiles will
> encapsulate the SAX-based file parsing. It will define a templated base
> class; to write an XML-formatted data file reader/writer, you derive
> your own class from this base class and implement/override methods to
> suit the object you with to read or write. The goal is to provide a
> mechanism for reading/writing XML files that doesn't require much
> knowledge of XML, which is a giant subject with not a lot of overlap
> with medical image processing.
vtkXMLParser is a class wrapper around expat that provides this kind of
interface. One derives from this class and overrides two or three virtual
methods that are handed each element with its attributes and contained
data. The class and expat together provide a very small, very fast XML
parsing framework with little memory overhead during parsing regardless of
the size of the document being parsed.
I suggest we take the VTK route and add expat to the Insight/Utilities
directory. Then we can add a non-templated itk::XMLParser class to
Insight/Code/IO based on the same design as vtkXMLParser. Then you could
derive your own parser class. I can help you get started.
-Brad