Skip to content

Instantly share code, notes, and snippets.

@sjshuck
Last active January 20, 2024 02:32
Show Gist options
  • Save sjshuck/883ce0bf323e9b2319b157b1e3bcfbad to your computer and use it in GitHub Desktop.
Save sjshuck/883ce0bf323e9b2319b157b1e3bcfbad to your computer and use it in GitHub Desktop.
XML is so...powerful πŸ˜’
<!-- Each entry is a child, which has a key child and a val child -->
<map>
<entry>
<key>foo</key>
<val>bar</val>
</entry>
<entry>
<key>baz</key>
<val>qux</val>
</entry>
</map>
<!-- Keys and values alternate -->
<map>
<key>foo</key>
<val>bar</val>
<key>baz</key>
<val>qux</val>
</map>
<!-- Each entry is a child whose tagname is the key and content is the val -->
<map>
<foo>bar</foo>
<baz>qux</baz>
</map>
<!-- Each entry is a child with key attribute and content is the val -->
<map>
<entry key="foo">bar</entry>
<entry key="baz">qux</entry>
</map>
<!-- Sort of a combination of the previous two -->
<map>
<foo val="bar" />
<baz val="qux" />
</map>
<!-- Entries have two attrs, one for key, one for value -->
<map>
<entry key="foo" val="bar" />
<entry key="baz" val="qux" />
</map>
<!-- Attrs are themselves a map -->
<map foo="bar" baz="qux" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment