But the starting point in the example was
<item name="name" value="John" />
<item name="city" value="London" />
where the key names are used as attributes, so it wouldn't work with arbitrary key names either, right?It would work (kind of); most XML parsers/generators would take care of escaping and unescaping quotes; but there's no way in the XML spec to escape characters in tag names.
XML allows arbitrary strings as key names just fine.
It's also not a good example of XML, because XML schemas should have a fixed list of tag names.