How attributes, mixed content, and arrays work in js2xmlparser
masterTo achieve specific XML structures, use these property patterns within your JavaScript objects:
Attributes
To add an attribute to an element, use the @ key.
Example: { "@": { type: "home" }, street: "123 St" } becomes <street type="home">123 St</street>.
Mixed Content (Text Values)
To add text content to an element that also has attributes, use the # key.
Example: { "@": { type: "home" }, "#": "123-555-4567" } becomes <phone type="home">123-555-4567</phone>.
Multiple Elements
To create multiple sibling elements with the same name, wrap the objects in an array.
Example: phone: [ { "#": "1" }, { "#": "2" } ] becomes <phone>1</phone><phone>2</phone>.