Using XML With WxWidgets

From WxWiki
Jump to: navigation, search

Currently, the developers of wxWidgets have chosen not to implement an 'official' XML parser into wxWidgets, leaving the user free to choose the one that fits his purposes best. There are several possibilities (all the following are cross-platform):

One possibility is to use TinyXML. TinyXML can be easily used along with wxWidgets. It is small and has a relatively easy learning curve. There is a guide on How To Use TinyXML With WxWidgets.

Alternately, Francesco Montorsi wrote a set of wrapper classes for the libxml2 library, which is a well-known cross-platform open source XML parsing library (it also supports various compilers). The wrappers are called wxxml2 and are hosted at http://wxcode.sourceforge.net/components/wxxml2.

Documentation on both of these can be found by following the links.

Using wxWidget's built-in XML parsers

Although wxWidgets does not have an official XML parser, some of its components have built-in parsers which may be used to parse other XML files:

  • wxWidget's XRC uses an XML parser that can be used to parse other files.
  • WxArt2d has an XML pull parsing system which can be extracted from wxArt2D

Note: documentation on using either of these two methods is scarce. Post to the mailing lists if you need help, or just use one of the ways mentioned earlier.

See also

Object serialization using XTI and XML