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

Empty type on xsd:element not handled as anyType ? #49

Closed
Eusebiotrigo opened this issue Apr 19, 2022 · 0 comments
Closed

Empty type on xsd:element not handled as anyType ? #49

Eusebiotrigo opened this issue Apr 19, 2022 · 0 comments

Comments

@Eusebiotrigo
Copy link

Description

I am using xgen to generate code in go.

The xsd extract is:

<xsd:complexType name="AccountHolder_Type">
xsd:sequence
xsd:choice
<xsd:element name="Individual" type="dpi:NameReportableSeller_Type"/>
xsd:sequence
<xsd:element name="Organisation" type="dpi:OrganisationParty_Type"/>
<xsd:element name="AcctHolderType"/>
</xsd:sequence>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>

and the code generated for that Type is:

type AccountHolderType struct {
XMLName xml.Name xml:"AccountHolder_Type"
Individual *NameReportableSellerType xml:"Individual"
Organisation *OrganisationPartyType xml:"Organisation"
AcctHolderType *AcctHolderType xml:"AcctHolderType"
}

And that AcctHolderType points to nothing, and, to be honest, not sure if it should generate a type or a string or it is that the XSD needs to declare its type there.

Steps to reproduce the issue:

  1. Use xgen to generate the code in goLang
  2. Use the DPIXML_v1.08.xsd from https://www.oecd.org/tax/exchange-of-tax-information/DPI-DAC7-XML-Schema-and-User-Guide-v2.03.zip

Describe the results you received:
type AccountHolderType struct {
XMLName xml.Name xml:"AccountHolder_Type"
Individual *NameReportableSellerType xml:"Individual"
Organisation *OrganisationPartyType xml:"Organisation"
AcctHolderType *AcctHolderType xml:"AcctHolderType"
}
Describe the results you expected:
Not really sure what to expect, but code does not compile as there is no AcctHolderType type declared
Output of go version:

go version go1.16.15 linux/amd64

xgen version or commit ID:

xgen version: 0.1.0

Environment details (OS, physical, etc.):
Fedora35

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