namespace
Xml
A minimal, deterministic XML reader for the element/attribute/CDATA subset the native Tiled formats (TMX/TSX/TX) use. Xml.parse turns a document into an element tree; the accessors read a node's tag, text, attributes (Xml.attr/Xml.attr_int/Xml.has) and children (Xml.child/Xml.find/Xml.count). It expands the five predefined entities and numeric character references, skips the <?xml?> prolog, comments and <!DOCTYPE>, and is best-effort rather than validating — the same contract as Json. Spliced on demand when a program mentions Xml.*.
Xml.parse(text: string) -> xmlParse XML text into an element tree.Xml.tag(node) -> stringThe element's tag name.Xml.text(node) -> stringThe element's character data.Xml.attr(node, key: string) -> stringAn attribute's value by name.Xml.attr_int(node, key: string, dflt: int) -> intAn attribute parsed as an integer.Xml.has(node, key: string) -> intWhether an attribute is present.Xml.attr_count(node) -> intHow many attributes the element has.Xml.child_count(node) -> intHow many child elements.Xml.child(node, index: int) -> xmlA child element by index.Xml.find(node, tag: string) -> xmlThe first child with a given tag.Xml.count(node, tag: string) -> intHow many children have a given tag.