-- Parsing .scxml documents into fsm.scxml_state / fsm.scxml_transition rows. -- -- Everything here matches elements by local-name() rather than by namespace, -- so a document is accepted whether or not it declares the SCXML namespace. -- -- Attributes are always read through xmltable rather than by casting the -- result of xpath() to text. Casting re-escapes the XML special characters, so -- a state named "Pick & Pack" would come back as "Pick & Pack"; -- xmltable hands back the decoded value. create or replace function fsm.__xml_attr(node xml, attribute_name text) returns text as $$ select value from xmltable('/*' passing node columns value text path ('@' || attribute_name)) $$ language sql immutable; -- Collects the