I have the following set of structs
that i need to write out in a certain way to XML:
type Parameter struct {
ParameterType string `xml:"param_type" json:"parameterType"`
ParameterValue string `xml:"param_value,omitempty" json:"parameterValue,omitempty"`
}
type Condition struct {
XMLName xml.Name
LeftParameter Parameter
Comparator string `xml:"comparator"`
RightParameter Parameter
}
type Conditions struct {
ConditionList []Condition `xml:"condition,omitempty" json:"condition,omitempty"`
}
I need to write both LeftParameter
and RightParameter
out as <param>
in the XML. It needs to look like this:
<conditions>
<condition>
<param>
<param_type>pop_ref</param_type>
<param_value>PtAge</param_value>
</param>
<comparator>GE</comparator>
<param>
<param_type>value</param_type>
<param_data_type>number</param_data_type>
<param_value>8</param_value>
</param>
</condition>
<conditions>
I assume that i should use the Marshaller interface for this, but i cannot figure out how to get it working.