Skip to content

Conversation

@carolinasolfernandez
Copy link
Contributor

Generates a marshal function to assign the default value when in an enumeration type there is only one posibility

Example:

<complexType name="Person">
		<complexContent>
				<sequence>
					<element name="type" minOccurs="1" maxOccurs="1">
						<simpleType>
							<restriction base="string">
								<enumeration value="Human" />
							</restriction>
						</simpleType>
					</element>
				</sequence>
			</extension>
		</complexContent>
	</complexType>
type Person struct {
	Type         _anon1    `xml:"type"`
}

// May be one of Human
type _anon1 string

func (x *_anon1) MarshalText() ([]byte, error) {
	return []byte("Human"), nil
}

@droyo
Copy link
Owner

droyo commented Jul 3, 2020

Hmm, what if the element is not provided at all, or is nillable? It doesn't seem correct to populate the value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants