GoComply / xsd2go

Automatically generate golang xml parser based on XSD
http://isimluk.com/posts/2020/05/xsd2go-automatically-generate-golang-xml-parsers/
The Unlicense
74 stars 44 forks source link

Sequence in sequence is not converted #135

Open nettnikl opened 2 months ago

nettnikl commented 2 months ago

Hey, the following:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            elementFormDefault="qualified" attributeFormDefault="qualified"
            version="1.0">
    <xsd:complexType name="AAA">
        <xsd:sequence>
            <xsd:element name="BBB" minOccurs="1" maxOccurs="1">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:string"/>
                </xsd:simpleType>
            </xsd:element>
            <xsd:sequence>
                <xsd:element name="CCC" minOccurs="1" maxOccurs="unbounded">
                    <xsd:simpleType>
                        <xsd:restriction base="xsd:string"/>
                    </xsd:simpleType>
                </xsd:element>
            </xsd:sequence>
        </xsd:sequence>
    </xsd:complexType>
</xsd:schema>

converts to:

// Code generated by https://github.com/gocomply/xsd2go; DO NOT EDIT.
// Models for
package test

import (
    "encoding/xml"
)

// XSD ComplexType declarations

type Aaa struct {
    XMLName xml.Name

    Bbb string `xml:",any"`
}

// XSD SimpleType declarations

While i would expect:

// Code generated by https://github.com/gocomply/xsd2go; DO NOT EDIT.
// Models for
package test

import (
    "encoding/xml"
)

// XSD ComplexType declarations

type Aaa struct {
    XMLName xml.Name

    Bbb string `xml:"BBB"`
    Ccc []string `xml:"CCC"`
}

// XSD SimpleType declarations