xsd-parser-rs
xsd-parser-rs copied to clipboard
Layered parsing/generating pipeline
To effectively resolve the following issues:
- #35
- #83
and to achieve better decomposition and extensibility, we are implementing a new approach, in which the parsing/generation pipeline deals with four levels of data representation:
- raw XML data;
- XSD models;
- abstract code;
- generated code in rust.
Thus, four conversions are occuring in the process:
- parsing raw text to XML Tree [We are using lib roxmltree. It`s fast and simple. However, this part is made replaceable];
- parsing XML data to XSD models;
- building an abstract code model based on XSD model;
- generating rust code;
Levels are well-isolated, meaning that structs from the current level know only about structs from one previous level. During each conversion, only two levels of abstraction are involved. Each level and transformer are customizable, meaning that the processing of vendor-specific elements might be easily implemented.
The main differences between the master branch and the new approach are:
- separation of XSD model layer and abstract code layer, which were mixed in master;
- resolving of dependencies/imports during abstract code model building.
Code generating is well-implemented in master and should change only slightly, while real changes coming to prior stages.
Here is the list of subtasks:
- [ ] Implement XML->XSD convertion for all XSD types from standard;
- [x] Integrate our custom XSD types from xsd-types;
- [x] Implement holders for the rest of XSD types presented in ONVIF;
- [x] Implement type resolver class to process imports and dependencies;
- [ ] (non-ONVIF) Implement holders for XSD types not presented in ONVIF;
- [ ] Implement XSD -> abstract code convertion for all types;
- [ ] Implement abstract code holders and type conversions for them (see https://github.com/lumeohq/xsd-parser-rs/issues/98);
- [ ] Implement dependency processing with XSD type resolver;
- [ ] Tweak code generation to generate from abstract code structs rather then structs in master branch.