Decimal type: Invalid non-element content error

  • Sergey Bushmanov

    When I try to assign decimal types I ran into different types of errors.

    I've ran into this error while doing with the following line:

    po.items = pyxb.BIND(pyxb.BIND('Lapis necklace', 1, 99.95, partNum='833-AA'),
                         pyxb.BIND('Plastic necklace', 4, 3.95, partNum='833-AB'))

    which threw me the following error:

    UnrecognizedContentError: Invalid content <pyxb.BIND object at 0x7fda1de1b048> (expect {URN:purchase-order}item)

    So I decided to reproduce it with a simpler example:

    <?xml version="1.0" encoding="utf-8"?>
    <xs:schema elementFormDefault="qualified" xmlns:xs="">
      <xs:element name="Item">
            <xs:element name="Name" type="xs:string" />
            <xs:element name="Price" type="xs:decimal" />

    When I run:

    !pyxbgen -u example_dec.xsd -m dec
    import dec
    item = dec.Item("Book", 2.1)

    I got:

    MixedContentError: Invalid non-element content

    What am I doing wrong?

    Thanks in advance!

  • Peter A. Bigot

    Peter A. Bigot - 2016-11-06

    You need the patch for issue #59.

  • Sergey Bushmanov

    Thanks, working!


Log in to post a comment.

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

Sign up for the SourceForge newsletter:

No, thanks