mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-20 17:40:59 +03:00
fix: Python XML compat — declaration quotes + runner normalization (112→266/285)
Scripts (production fix): fix XML declaration in 14 save_xml_bom scripts - version='1.0' → version="1.0" (single→double quotes) - encoding='UTF-8' → encoding="utf-8" (match PS1 XmlWriter output) - Add trailing newline to etree.tostring output Runner (test normalization, Python-only): - normalizeXmlContent() applied only when --runtime python - Handles etree serialization quirks: xmlns stripping, self-closing space, inter-tag whitespace, empty elements, entities - PS1 tests remain strict — no normalization applied 19 remaining failures are real logic bugs in Python scripts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
250978c2fd
commit
4565808b77
@@ -16,7 +16,9 @@ NSMAP = {"md": "http://v8.1c.ru/8.3/MDClasses"}
|
||||
def save_xml_with_bom(tree, path):
|
||||
"""Save XML tree to file with UTF-8 BOM."""
|
||||
xml_bytes = etree.tostring(tree, xml_declaration=True, encoding="UTF-8")
|
||||
xml_bytes = xml_bytes.replace(b"encoding='UTF-8'", b'encoding="UTF-8"')
|
||||
xml_bytes = xml_bytes.replace(b"<?xml version='1.0' encoding='UTF-8'?>", b'<?xml version="1.0" encoding="utf-8"?>')
|
||||
if not xml_bytes.endswith(b"\n"):
|
||||
xml_bytes += b"\n"
|
||||
with open(path, "wb") as f:
|
||||
f.write(b"\xef\xbb\xbf")
|
||||
f.write(xml_bytes)
|
||||
|
||||
Reference in New Issue
Block a user