Write a Python function to parse a complex XML or JSON configuration file and extract specific attributes into a relational schema.
Implement parse_config(config_text, config_format, records_path, fields). config_format is "xml" or "json"; records_path identifies repeated record objects using / for XML and . for JSON; fields maps output column names to paths relative to each record. XML attributes use @name. Return a list of dictionaries in source order. Missing paths must produce None; repeated field values must be returned as lists. Assume valid XML or JSON and scalar field values unless a path selects multiple values.
def parse_config(config_text, config_format, records_path, fields):