-
-
Notifications
You must be signed in to change notification settings - Fork 103
Closed
Description
Description
Basically the title.
I've created the minimal XSD to get the issue:
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://example.com/myschema"
xmlns:xs="http://example.com/myschema"
elementFormDefault="qualified">
<complexType name="SomeComplexType">
<sequence>
<!-- First element appears with no issues -->
<element name="FirstElement" type="int" />
<element name="ElementWithSimpleType">
<simpleType>
<restriction base="string" />
</simpleType>
</element>
<!-- After the first SimpleType in ComplexType, the elements don't appear properly in
the final struct -->
<element name="OtherElementWithSimpleType">
<simpleType>
<restriction base="string" />
</simpleType>
</element>
<!-- Even the elements without SimpleType don't appear properly -->
<element name="ElementWithoutSimpleType" type="int" />
</sequence>
</complexType>
</schema>
Might be related to #63 and #80. They use the simpleType in their XSD in the problematic chunk of code.
Steps to reproduce the issue:
- Copy the above XSD to a blank file (minimal.xsd)
- Run
xgen -l Go -i minimal.xsd
Describe the results you received:
// Code generated by xgen. DO NOT EDIT.
package schema
// SomeComplexType ...
type SomeComplexType struct {
FirstElement int `xml:"FirstElement"`
ElementWithSimpleType *ElementWithSimpleType `xml:"ElementWithSimpleType"`
}
// ElementWithSimpleType ...
type ElementWithSimpleType *ElementWithSimpleType
// String ...
type String string
// OtherElementWithSimpleType ...
type OtherElementWithSimpleType *OtherElementWithSimpleType
// ElementWithoutSimpleType ...
type ElementWithoutSimpleType intDescribe the results you expected:
// Code generated by xgen. DO NOT EDIT.
package schema
// SomeComplexType ...
type SomeComplexType struct {
FirstElement int `xml:"FirstElement"`
ElementWithSimpleType string `xml:"ElementWithSimpleType"`
OtherElementWithSimpleType string `xml:"OtherElementWithSimpleType"`
ElementWithoutSimpleType int `xml:"ElementWithoutSimpleType"`
}Output of go version:
go version go1.24.0 linux/amd64
xgen version or commit ID:
xgen version: 0.1.0
Metadata
Metadata
Assignees
Labels
No labels