1/*
2Package xml holds the XMl encoder utility. This utility is written in accordance to our design to delegate to
3shape serializer function in which a xml.Value will be passed around.
4
5Resources followed: https://smithy.io/2.0/spec/protocol-traits.html#xml-bindings
6
7Member Element
8
9Member element should be used to encode xml shapes into xml elements except for flattened xml shapes. Member element
10write their own element start tag. These elements should always be closed.
11
12Flattened Element
13
14Flattened element should be used to encode shapes marked with flattened trait into xml elements. Flattened element
15do not write a start tag, and thus should not be closed.
16
17Simple types encoding
18
19All simple type methods on value such as String(), Long() etc; auto close the associated member element.
20
21Array
22
23Array returns the collection encoder. It has two modes, wrapped and flattened encoding.
24
25Wrapped arrays have two methods Array() and ArrayWithCustomName() which facilitate array member wrapping.
26By default, a wrapped array members are wrapped with `member` named start element.
27
28 <wrappedArray><member>apple</member><member>tree</member></wrappedArray>
29
30Flattened arrays rely on Value being marked as flattened.
31If a shape is marked as flattened, Array() will use the shape element name as wrapper for array elements.
32
33 <flattenedAarray>apple</flattenedArray><flattenedArray>tree</flattenedArray>
34
35Map
36
37Map is the map encoder. It has two modes, wrapped and flattened encoding.
38
39Wrapped map has Array() method, which facilitate map member wrapping.
40By default, a wrapped map members are wrapped with `entry` named start element.
41
42 <wrappedMap><entry><Key>apple</Key><Value>tree</Value></entry><entry><Key>snow</Key><Value>ice</Value></entry></wrappedMap>
43
44Flattened map rely on Value being marked as flattened.
45If a shape is marked as flattened, Map() will use the shape element name as wrapper for map entry elements.
46
47 <flattenedMap><Key>apple</Key><Value>tree</Value></flattenedMap><flattenedMap><Key>snow</Key><Value>ice</Value></flattenedMap>
48*/
49package xml