Mapping Rules
- 03 Jun 2022
- 1 Minute to read
- Print
- DarkLight
Mapping Rules
- Updated on 03 Jun 2022
- 1 Minute to read
- Print
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
Mapping Rules
- Namespaces, namespace prefixes, comments, and processing instructions are all ignored.
- Elements with no attributes and no content or whitespace-only content become null.
- Elements with no subelements and no attributes become the text, numeric, or boolean value of the element content.ActionScript
<x>Hello</x> becomes "Hello"
- Elements with attributes or child elements become a record.
- Nested element names (sans any namespace prefix) become record fieldsActionScript
<x> <y>Hello</y> </x> becomes { "y": "Hello" }
- Attributes become record fields prefixed with @.ActionScript
<x> <y z="1"/> </x> becomes { "y": { "@z": 1 } }
- If an element has attributes and non-empty text-only content, then the text content becomes a record field named value.ActionScript
<x> <y z="1">Hello</y> </x> becomes { "y": { "@z": 1, "value": "Hello" } }
- Multiple elements with the same name at the same level become multiple values of the same field.ActionScript
<x> <y>Hello</y> <y>Goodbye</y> </x> becomes { "y": ["Hello", "Goodbye"] }
- If an element has mixed content (intermixed text and elements), then the text is ignored.ActionScript
<x> <y>Hello</y> Something in between <y>Goodbye</y> </x> becomes { "y": ["Hello", "Goodbye"] }
Was this article helpful?