xgen -i dtc-11-04-05.xsd -o go/schema/xgen_out.go -l Go
cp go/schema/xgen_out.go go/models/models.go
sed -i '' 's/\/\/ Code generated by gowsdl DO NOT EDIT.//g' go/models/models.go
sed -i '' 's/package schema/package models/g' go/models/models.go
sed -i '' '/type REQIF \*REQIF/c\
type REQIF struct {\
XMLName xml.Name `xml:"REQ-IF"`\
HEADER *THEHEADER `xml:"THE-HEADER"`\
CORECONTENT *CORECONTENT `xml:"CORE-CONTENT"`\
}\
' go/models/models.go
sed -i '' 's/package schema/package models/g' go/models/models.go
sed -i '' 's/type \([A-Za-z0-9_]*\) struct {/type \1 struct { \
Name string/g' go/models/models.go
sed -i '' 's/XhtmlBlkStructClass \*XhtmlBlkStructClass//g' go/models/models.go
with vscode, refactor TYPE into REQTYPE
time gongc go/models
gowsdl -d go -p schema -o schema.go reqif.wsdl
Things are doing great but for attibutes, it does not work.
<SPEC-OBJECT
IDENTIFIER="_xen_QMkhEee8KsfWrp9EJQ"
LAST-CHANGE="2017-11-14T15:44:26.000+02:00"
LONG-NAME="Requirement-1">
Is there something in the XSD that says it is an attribute and not an element ?
Yes it does
<xsd:attribute name="DESC" type="xsd:string" use="optional"/>
<xsd:attribute name="IDENTIFIER" type="xsd:ID" use="required"/>
<xsd:attribute name="LAST-CHANGE" type="xsd:dateTime" use="required"/>
<xsd:attribute name="LONG-NAME" type="xsd:string" use="optional"/>
We have to go back to xmlplaygground
\b[A-Z-]+=
reqif.xsd:$0
It's strange, SPEC HIERARCHY has only one "children"
There is a problem because the XSD says that SPEC_TYPES is a slice of object
and the schema has only one pointer.
in fact, the XSD has no slice of pointers at all.
One needs to go back to the xmlplayground.
Indeed, gowsdl has trouble with this xsd def. By patching the schema
SPEC_OBJECT_TYPE []*SPEC_OBJECT_TYPE `xml:"SPEC-OBJECT-TYPE,omitempty" json:"SPEC-OBJECT-TYPE,omitempty"`
this works
serie of sed to apply
[]
IDENTIFIER []ID IDENTIFIER ID
REQ_IF_CONTENT [] REQ_IF_CONTENT
REQ_IF_HEADER [] REQ_IF_HEADER
SPEC_OBJECT_REF [] SPEC_OBJECT_REF
[]LOCAL_REF LOCAL_REF