{"id":17177972,"url":"https://github.com/curusarn/xml-config-parser","last_synced_at":"2025-03-24T22:45:32.056Z","repository":{"id":129173553,"uuid":"76876983","full_name":"curusarn/xml-config-parser","owner":"curusarn","description":"Python module that parses XML config files with defined structure","archived":false,"fork":false,"pushed_at":"2016-12-21T14:10:51.000Z","size":10,"stargazers_count":2,"open_issues_count":2,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-30T02:24:23.755Z","etag":null,"topics":["python","xml","xml-config-parser"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/curusarn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-19T16:12:41.000Z","updated_at":"2024-10-29T12:23:49.000Z","dependencies_parsed_at":"2023-07-06T20:33:51.395Z","dependency_job_id":null,"html_url":"https://github.com/curusarn/xml-config-parser","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"fe8fb1c09bbd59d059b00a094ca6ddde3217b801"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curusarn%2Fxml-config-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curusarn%2Fxml-config-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curusarn%2Fxml-config-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curusarn%2Fxml-config-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/curusarn","download_url":"https://codeload.github.com/curusarn/xml-config-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245366197,"owners_count":20603438,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","xml","xml-config-parser"],"created_at":"2024-10-15T00:05:37.060Z","updated_at":"2025-03-24T22:45:32.031Z","avatar_url":"https://github.com/curusarn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xml-config-parser\nPython module that parses XML config files with defined structure.  \n\n\n## Example\n\nXml file:\n```\n\u003c?xml version=\"1.0\" encoding=\"utf8\"?\u003e\n\u003cconfiguration\u003e\n    \u003cbasicConfig\u003e\n        \u003coptionalOption\u003eValue\u003c/optionalOption\u003e\n        \u003crequiredOption\u003eValue\u003c/requiredOption\u003e\n    \u003c/basicConfig\u003e\n    \u003cnextConfig\u003e\n        \u003cbool\u003eFalse\u003c/bool\u003e\n        \u003cwhatever\u003eWUBBA LUBA DUB-DUB\u003c/whatever\u003e\n    \u003c/nextConfig\u003e\n\u003c/configuration\u003e\n```\n\nPython code:\n```\nfrom xmlConfigParser import XmlConfigParser\n\n# NOTE: specify config options like this \n# NOTE: options with \"None\" as default value are required\n# NOTE: sections with no required options are optional:\ncfgValues = {\n    \"basicConfig\": {\n        \"optionalOption\": \"default_value\",\n        \"requiredOption\": None\n    },\n    \"nextConfig\": {\n        \"bool\": \"True\",\n        \"whatever\": None\n    },\n    \"optionalConfigSection\": {\n        \"opt1\": \"def_val1\",\n        \"opt2\": \"def_val2\"\n    }\n}\n\ncfg = XmlConfigParser(cfgValues, \"/path/to/xml/config\", \"basicConfig\")\n\n# HACK: you can write your custom conditions and mess with default values and their optionality\\\n                                                            before you run parseXmlConfig()\n# if /optionalConfigSection is present: set default value for /nextConfig/whatever\nif not cfg.getRoot().find(\"basicConfig\") is None:\n    cfg.set(\"new_value\", \"whatever\", \"nextConfig\")\n# HACK: this makes /nextConfig/whatever optional\n\n# NOTE: parseXmlConfig will raise XmlConfigParserException if any of required options are missing\ncfg.parseXmlConfig()\n\n# returns value of \"whatever\" from \"nextConfig\" section\nsomeValue = cfg.get(\"whatever\", \"nextConfig\")\n\n# converts to bool value of \"bool\" from \"nextConfig\" section\nboolValue = cfg.getBool(\"bool\", \"nextConfig\")\n\n# returns value of \"whatever\" from default section specified in constructor\nsomeOtherValue = cfg.get(\"optionalOption\")\n\n```\n\n## Dependencies\n`xml` python library.  \nYou can install this dependency using `pip`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcurusarn%2Fxml-config-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcurusarn%2Fxml-config-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcurusarn%2Fxml-config-parser/lists"}