Content type mismanagement with renamed element
Brought to you by:
pabigot
Refer to the example posted in the Help forum: https://sourceforge.net/projects/pyxb/forums/forum/956708/topic/3526055
If the field element created by the second-level pyxb.BIND wrapper uses key=value syntax instead of positional parameters, there is a conflict because the second element is named "value". PyXB will have renamed that to "value_". Attempts to use "value=pyxb.BIND(...)" seem to cause the corresponding element to be dropped; attempts to use "value_=pyxb.BIND(...)" generate a content error.
The use of "value" elicits the problem described in #76. Ignore that for now. The use of "value_" should work.
This has close associations with #75.
add link to referenced help forum example posting.
The first case does fail because "value" is not a valid element after the renaming. PyXB should have validated that when the append was invoked, not simply stored the value in the content list.
The second fails because the element is plural, but is being invoked as a "set" with a non-plural value. This is valid for the non-keyword version because the state machine can expect additional elements; with keyword, the state requires all elements to be provided at once.
Again this should have been validated at the time of the append.
The other part of this is fixed in the context of #69.
commit 993c26292c883528f35bc3a6a1f657ddd7a47dc0
Author: Peter A. Bigot <pab@‌>
Date: Sun Dec 16 08:52:25 2012 -0600
When a pyxb.BIND instance is not recognized, raise a content error rather than attempting to provide it as mixed content
When a pyxb.BIND instance is being set as an element value, convert it to a compatible value even if validation is not occurring.