schema - How do I reproduce Relax NG rules in C++ objects? -
at momemet working on part of application need parse relax ng schema , reproduce rules within file in c++ objects. start example code can explain better.
<!-- property.element --> <define name="property.element"> <element name="property"> <attribute name="type" /> <interleave> <zeroormore> <ref name="resource.class" /> </zeroormore> <ref name="literal.class" /> </interleave> </element> </define>
i want create object can store information like:
- [define] name,
- element name,
- attribute names,
- allowed child elements associated rules (zero or more, 1 or more).
then want display possible elements in gui can add valid (in terms of relax ng schema) elements tree-like structure. example - can add resource.class or literal.class property.element, every other possible element greyed in gui when have selected property.element node in gui. use qt, load schema qdomdocument access dom tree.
such mechanism has universal i.e. no matter how elements named, or how structure is. in draft created simple class placed several members like: defined_name, element_name, required_attributes, optional_attributes. stuck because not have idea how represent rules in c++ class. if had constant set of objects on work hard-code every object, objects set change drastically on time. have idea?
convert rng file xsd using trang, convert xsd c++ using codesynthesis either xsd or xsde). there bunch of samples xsde, there might 1 demonstrating how validate xml input schema rules.
http://www.thaiopensource.com/relaxng/trang.html http://www.codesynthesis.com/products/xsde/
Comments
Post a Comment