local M = {} local uv = vim.loop local api = vim.api local function read_file(path) local fd = io.open(path, "r") if not fd then return nil end local content = fd:read("*a") fd:close() return content end local function write_file(path, content) local dir = path:match("(.*/)[^/]+$") if dir then vim.fn.mkdir(dir, "p") end local fd = io.open(path, "w") if not fd then error("Cannot write " .. path) end fd:write(content) fd:close() end -- Minimal XML attribute extractor for a tag like: