Working with XML

XML nodes, attributes and text can be accessed as json syntax, but there are a couple of rules to take in account


xml

1
<Person>John Doe</Person>

html

1
{{Person.__}}

result

1
John Doe


xml

1
<Person name="John Doe"></Person>

html

1
{{Person._name}}

result

1
John Doe


Iterate over an array

xml

1
2
3
4
5
6
7
8
9
10
11
<Friends>
<Friend>
<Name>John</Name>
</Friend>
<Friend>
<Name>Mike</Name>
</Friend>
<Friend>
<Name>Maria</Name>
</Friend>
</Friends>

html

1
2
3
{{#each Friends.Friend}}
<div>{{Name.__}}</div>
{{/each}}

result

1
2
3
<div>John</div>
<div>Mike</div>
<div>Maria</div>