#99 default/fixed elements

PyXB 1.2.1
closed
None
fixed
Binding model
major
PyXB 1.1.2
enhancement
2012-12-17
2011-01-12
El_Boho
No

Is there support in pyxbgen (1.1.2) for elements with default or fixed values? I've had no problem with attributes coming through with defaults but elements do not. When I change the sample schema to have element defaults I do not see them in the resulting pyxbgen wrapper.

<xsd:element name="street" type="xsd:string" default="default street"/>
<xsd:element name="city"   type="xsd:NMTOKEN" fixed="fixed city"/>
<xsd:attribute name="country" type="xsd:NMTOKEN" fixed="Works for attr"/>

Discussion

  • Peter A. Bigot

    Peter A. Bigot - 2011-05-22
    • status changed from new to accepted

    The answer, as you may have surmised, is no, there is no such support. It may be a little tricky to add, or it may be trivial, as it appears I defined a method on the element use class that was intended to support default values.

     
  • Peter A. Bigot

    Peter A. Bigot - 2011-09-09
    • milestone changed from PyXB 1.1.3 to PyXB 1.1.4
     
  • Peter A. Bigot

    Peter A. Bigot - 2011-10-23

    Subset of tests required to validate this:

    • Pass all existing tests
    • Add tests that default values appear in unmodified new elements
    • Add tests that changing a value when there is a default is correct
    • Define the behavior for plural elements
    • Test the behavior for plural elements, including cases where only

    certain ones are changed from the default

    • Add test for fixed element of simple type
    • Define and test behavior for attempts to set the value of an element

    with a fixed type

    • Determine when the default and fixed values are validated against the

    content model and test this

    • Repeat the above as necessary to ensure elements using xsi:type

    validate correctly

     
  • Peter A. Bigot

    Peter A. Bigot - 2012-06-13
    • milestone changed from PyXB 1.1.4 to PyXB 1.1.5
     
  • Peter A. Bigot

    Peter A. Bigot - 2012-08-30
    • milestone changed from PyXB 1.1.5 to PyXB 1.2.0
     
  • Peter A. Bigot

    Peter A. Bigot - 2012-11-08
    • milestone changed from PyXB 1.2.0 to PyXB 1.2.1
     
  • Peter A. Bigot

    Peter A. Bigot - 2012-12-17
    • status changed from accepted to closed
    • resolution set to fixed

    Fixed in following commit.

    commit 7ec0c36d2005848bd5668482f906149a67c0a033
    Author: Peter A. Bigot <pab@‌>
    Date: Mon Dec 17 08:27:42 2012 -0600

    trac/99: default/fixed elements

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks