What is the XML support in Pike like?
Pike ships with the Parser.XML module — Parser.XML.Tree.simple_parse_input(string) returns a DOM-like Node hierarchy you can walk via get_first_element, get_attributes, and get_children. There is also Parser.XML.SloppyDOM for tolerant parsing of malformed XML and Parser.XML.NSTree for namespace-aware trees. Pike has been used in production at Roxen since the late 1990s, so the XML modules are mature and battle-tested.
How are XML attributes mapped to Pike fields?
Both attributes and child elements become typed fields on the generated Pike class, with attributes flagged by an inline "// attribute" comment. When you populate the class via Parser.XML.Tree, attribute values come from node->get_attributes() (a mapping(string:string)) while element values come from node->get_first_element("title")->value_of_node().
Why is Pike statically and dynamically typed?
Pike supports both styles: declared types (string, int, float, array) get compile-time checks, while mixed allows fully dynamic values. The generator emits explicit types for every field so the compiler catches mismatches early — but you can change any field to mixed if your XML carries genuinely heterogeneous content (e.g. union of string-or-array).
How are repeated elements like <tag> represented?
Repeated child elements become array(T) fields. Pike arrays are typed and dynamically sized; populate them by iterating node->get_elements("tag") and pushing each parsed value into the array with += ({ Tag(...) }).
Why class instead of mapping?
Pike mappings are open-ended hashmaps — convenient for ad-hoc data but they lose the per-field type information you want for XML modelling. Pike classes are closed records with typed members, equivalent to structs in other languages, and they support inheritance plus methods if you need to add helper functions later. Use a mapping when the XML has unbounded keys; use a class when the schema is fixed.
Does Pike enforce nullability?
Not by default. A Pike string is nullable (UNDEFINED is a valid value of any reference type). To require non-null, initialise the field at declaration with a default value or check for UNDEFINED in your constructor. The generator stays neutral — you decide which fields demand a value.
Is the XML I paste sent to your servers?
No. XML is parsed by the browser DOMParser and the Pike source is generated entirely in JavaScript on your machine. Open DevTools → Network and you will see no requests when you click Convert. Safe for SOAP responses and configuration files containing API keys or credentials.
How do I parse XML into the generated Pike class?
object root = Parser.XML.Tree.simple_parse_input(xml)->get_first_element(); Book b = Book(); b->id = root->get_attributes()["id"]; b->title = root->get_first_element("title")->value_of_node(); — repeated for each field. The Pike arrow operator (->) on objects is the equivalent of dot in C++/Java.