i've got complexType Elements with child elements that have to appear in the document (e.g. minOccurs=1, maxOccurs=1). Is there a way to tell PyXB to create the children (recursively) as well? I think that would make writing much easier.
Best
Stefan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No, that feature isn't present. Thel solution requires generating a conforming document for an arbitrary content model. While this is probably possible (and was a proposed feature several years ago), in many cases the result is an empty element; in other cases it's a complex element that carries structure without information.
PyXB is intended to simplify the process of converting between Python and XML representations of documents. Unfortunately there's no substitute for the developer understanding the requirements of the document model. You could, though, extend the generated bindings with factory methods that provide stubs for the sub-elements you expect to use.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
i've got complexType Elements with child elements that have to appear in the document (e.g. minOccurs=1, maxOccurs=1). Is there a way to tell PyXB to create the children (recursively) as well? I think that would make writing much easier.
Best
Stefan
No, that feature isn't present. Thel solution requires generating a conforming document for an arbitrary content model. While this is probably possible (and was a proposed feature several years ago), in many cases the result is an empty element; in other cases it's a complex element that carries structure without information.
PyXB is intended to simplify the process of converting between Python and XML representations of documents. Unfortunately there's no substitute for the developer understanding the requirements of the document model. You could, though, extend the generated bindings with factory methods that provide stubs for the sub-elements you expect to use.