Menu

Automatically create child elements for minOccurs>0

Help
Esteve
2016-01-26
2016-01-26
  • Esteve

    Esteve - 2016-01-26

    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

     
  • Peter A. Bigot

    Peter A. Bigot - 2016-01-26

    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.

     

Log in to post a comment.

MongoDB Logo MongoDB