A simple python script to generate C++ bindings from an XML Schema definition, with support for bootstrapped Qt
- Generates a Qt-based XML parser and data structures from XSD-Files
- Only depends on QXmlStreamReader (which is part of QtCore)
- Can automatically integrate QXmlSchema to validate files before parsing
The package is provided via qdep, as Skycoder42/QXmlCodeGen. To use it simply:
- Install and enable qdep (See qdep - Installing)
- Add the following to your pro file:
QDEP_DEPENDS += Skycoder42/QXmlCodeGen
!load(qdep):error("Failed to load qdep feature! Run 'qdep prfgen --qmake $$QMAKE_QMAKE' to create it.")Simply create an XSD file and add it to your project as:
XML_SCHEMA_DEFINITIONS += myschema.xsdThis will generate myschema.h and myschema.cpp and automatically include them into your project. To use the generated parser to actually parse XML data, you can use it as follows:
MySchema parser;
auto data = parser.readDocument("/path/to/data.xml");