Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code generator can add multiple text nodes #249

Closed
tefra opened this issue Sep 3, 2020 · 1 comment
Closed

Code generator can add multiple text nodes #249

tefra opened this issue Sep 3, 2020 · 1 comment

Comments

@tefra
Copy link
Owner

tefra commented Sep 3, 2020

And here's the xsd that disproves the rule of one text node per model and is blocking the #246

  <xs:element name="appendix" substitutionGroup="chap">
    <!-- valid restriction of the base type -->
    <xs:alternative test="@type='date'">
        <xs:complexType>
            <xs:simpleContent>
                <xs:extension base="xs:date">
                    <xs:attribute name="type" type="xs:NCName"/>
                </xs:extension>
            </xs:simpleContent>
        </xs:complexType>
    </xs:alternative>
    <xs:alternative test="@type='dateTime'">
        <xs:complexType>
            <xs:simpleContent>
                <xs:extension base="xs:dateTimeStamp">
                    <xs:attribute name="type" type="xs:NCName"/>
                </xs:extension>
            </xs:simpleContent>
        </xs:complexType>
    </xs:alternative>
    <xs:alternative test="@type='time'">
        <xs:complexType>
            <xs:simpleContent>
                <xs:extension base="xs:time">
                    <xs:attribute name="type" type="xs:NCName"/>
                </xs:extension>
            </xs:simpleContent>
        </xs:complexType>
    </xs:alternative>    
  </xs:element>  
@dataclass
class Appendix:
    """
    :ivar value:
    :ivar value_1:
    :ivar value_2:
    :ivar type:
    """
    class Meta:
        name = "appendix"

    value: Optional[str] = field(
        default=None,
    )
    value_1: Optional[str] = field(
        default=None,
    )
    value_2: Optional[str] = field(
        default=None,
    )
    type: Optional[str] = field(
        default=None,
        metadata=dict(
            type="Attribute"
        )
    )
@tefra
Copy link
Owner Author

tefra commented Sep 4, 2020

That's actually my only sample 😳 out of all the w3c tests and samples

@tefra tefra closed this as completed in 8796bb7 Sep 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant