I use a trivial XML callback parser to capture the structure and details of the data model and spit out DDL. It is rather simple to do. In the case of TR-181, it is hard because of actions that must occur on DML (and why the number of triggers is large). I would not recommend something has hard as CWMP for your first project! The idea is the spit out "CREATE TABLE *XML element name*(" when an XML element starts. Then ",*XML sub element name* **type**" for each sub element that's a column. Then a closing ");" when the first element closes. Depending on other attributes / sub elements, you can add CHECK constraints, etc. Again, it's trivial, until it's not.