Description
Under certain conditions, some of the choices in an xs:choice do not get generated. In the enclosed example, there is on a6 field in the generated go code. This bug is subtle!!! If you remove the input for the "d" attribute from the source file, it will generate all 6 of the a elements.
Steps to reproduce the issue:
Run xgen with the go output option on the test case.
save the output
Remove the code for the d attribute from the test case and rerun.
here is the input to use
<?xml version="1.0" encoding="UTF-8"?>
=============
Describe the results you received:
// Code generated by xgen. DO NOT EDIT.
package test1
import (
"encoding/xml"
)
// E ...
type E struct {
XMLName xml.Name xml:"e"
DAttr string xml:"d,attr"
A1 []A1 xml:"a1"
A2 []A2 xml:"a2"
A3 []A3 xml:"a3"
A4 []A4 xml:"a4"
A5 []*A5 xml:"a5"
E string xml:"e"
}
Description Under certain conditions, some of the choices in an xs:choice do not get generated. In the enclosed example, there is on a6 field in the generated go code. This bug is subtle!!! If you remove the input for the "d" attribute from the source file, it will generate all 6 of the a elements.
Steps to reproduce the issue:
Remove the code for the d attribute from the test case and rerun. here is the input to use
<?xml version="1.0" encoding="UTF-8"?>
============= Describe the results you received: // Code generated by xgen. DO NOT EDIT.
package test1
import ( "encoding/xml" )
// E ... type E struct { XMLName xml.Name
xml:"e"
DAttr stringxml:"d,attr"
A1 []A1xml:"a1"
A2 []A2xml:"a2"
A3 []A3xml:"a3"
A4 []A4xml:"a4"
A5 []*A5xml:"a5"
E stringxml:"e"
}// A1 ... type A1 struct { XMLName xml.Name
xml:"a1"
NAttr stringxml:"n,attr"
}// A2 ... type A2 struct { XMLName xml.Name
xml:"a2"
NAttr stringxml:"n,attr"
}// A3 ... type A3 struct { XMLName xml.Name
xml:"a3"
NAttr stringxml:"n,attr"
}// A4 ... type A4 struct { XMLName xml.Name
xml:"a4"
NAttr stringxml:"n,attr"
}// A5 ... type A5 struct { XMLName xml.Name
xml:"a5"
NAttr stringxml:"n,attr"
}// A6 ... type A6 struct { XMLName xml.Name
xml:"a6"
NAttr stringxml:"n,attr"
}Describe the results you expected: // Code generated by xgen. DO NOT EDIT.
package test1
import ( "encoding/xml" )
// E ... type E struct { XMLName xml.Name
xml:"e"
DAttr stringxml:"d,attr"
A1 []A1xml:"a1"
A2 []A2xml:"a2"
A3 []A3xml:"a3"
A4 []A4xml:"a4"
A5 []A5xml:"a5"
A6 []A6xml:"a6"
E stringxml:"e"
}// A1 ... type A1 struct { XMLName xml.Name
xml:"a1"
NAttr stringxml:"n,attr"
}// A2 ... type A2 struct { XMLName xml.Name
xml:"a2"
NAttr stringxml:"n,attr"
}// A3 ... type A3 struct { XMLName xml.Name
xml:"a3"
NAttr stringxml:"n,attr"
}// A4 ... type A4 struct { XMLName xml.Name
xml:"a4"
NAttr stringxml:"n,attr"
}// A5 ... type A5 struct { XMLName xml.Name
xml:"a5"
NAttr stringxml:"n,attr"
}// A6 ... type A6 struct { XMLName xml.Name
xml:"a6"
NAttr stringxml:"n,attr"
}Output of
go version
: xgen version: 0.1.0xgen version or commit ID:
Environment details (OS, physical, etc.): ubuntu 20.04 x86-64