wxXml2

Categories: data container,import/export,wrapperStatus: STABLEComponent logo
Author: Francesco MontorsiwxWidgets supported ports: all
Current maintainer: Francesco MontorsiwxWidgets supported versions: 2.6, 2.8
Latest version: 1.8Build system: Bakefile-based
Programming language: C++Samples provided: 1
External dependencies: libxml2, iconv (built-in for win32)Documentation: doxygen

Description: A simple set of classes, wxXml2Namespace, wxXml2Property, wxXml2Node, wxXml2DTD and wxXml2Document, that interfaces wxWidgets with libxml2. With this component you can add load/save/edit XML support to your wxWidgets application using all the power of a well-known library like libxml2. The full support for DTDs allows you to easily check your XML documents & thus to produce well-formed XML files. Unicode and shared builds are completely supported as well.

Links for wxXml2:


Usage sample

^ TOP

// parse an XML file
wxXml2Document doc;
if (!doc.Load("myfile.xml"))
return false;

// start processing the XML file
if (doc.GetRoot()->GetName() != "myroot-node")
return false;

wxXml2Node *child = doc.GetRoot()->GetChildren();
while (child) {

        if (child->GetName() == "tag1") {

                // process text enclosed by tag1/tag1
                wxString content = child->GetNodeContent();

                ...

                // process attributes of tag1
                wxString attrvalue1 =
                child->GetProperty("attr1", "default-value");
                wxString attrvalue2 =
                child->GetProperty("attr2", "default-value");

                ...

        } else if (child->GetName() == "tag2") {

                // process tag2 ...
        }

        child = child->GetNext();
}

Screenshots

^ TOP

Obviously, since wxXml2 is not an application but just a wrapper for the libxml2 library, the following screenshots refers to the sample app included with this module which shows how much easy is to get the tree structure of an XML doc through wxXml2 classes:


The wxXml2 sample running on Windows XP      The wxXml2 sample running on Red Hat 9

Documentation

^ TOP

The doxygen-generated documentation for this component is available online here. Please let me know if you think something is missing.


Known bugs

^ TOP

None. To submit a bug report please look at wxCode FAQ.


Future enhancements

^ TOP

Support for libxsl.
To submit a feature request please look at wxCode FAQ.