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

xsi:type on root nodes is not working as expected #267

Closed
tefra opened this issue Sep 27, 2020 · 0 comments
Closed

xsi:type on root nodes is not working as expected #267

tefra opened this issue Sep 27, 2020 · 0 comments
Labels

Comments

@tefra
Copy link
Owner

tefra commented Sep 27, 2020

<xsd:schema
  xmlns="ST_targetNS"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  targetNamespace="ST_targetNS">
     <xsd:simpleType name="Test">
          <xsd:restriction base="xsd:string">
               <xsd:pattern value="1|2" />
          </xsd:restriction>
     </xsd:simpleType>
</xsd:schema>
@dataclass
class Test:
    """
    :ivar value:
    """
    value: Optional[str] = field(
        default=None,
        metadata=dict(
            pattern=r"1|2"
        )
    )

Valid input

<test
    xmlns="ST_targetNS"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="ST_targetNS ST_targetNS00201m.xsd" xsi:type="Test">2</test>

xsdata serializer

<Test xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">2</Test
@tefra tefra added the known label Sep 27, 2020
tefra added a commit that referenced this issue Sep 28, 2020
Notes:
Introduce new DerivedElement generic wrapper!
tefra added a commit that referenced this issue Sep 28, 2020
Notes:
Introduce new DerivedElement generic wrapper!
tefra added a commit that referenced this issue Sep 29, 2020
Notes:
Introduce new DerivedElement generic wrapper!
tefra added a commit that referenced this issue Sep 29, 2020
Notes:
Introduce new DerivedElement generic wrapper!
@tefra tefra closed this as completed in 12fc270 Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant