mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-06-18 22:03:04 +00:00
xml: preserve DOCTYPE declaration when writing XML files (#12148)
* fix(xml): preserve DOCTYPE declaration when writing XML files
Pass `doctype=tree.docinfo.doctype` to all `ElementTree.write()` calls
so lxml does not silently drop the DOCTYPE on serialization. Also replace
`etree.tostring()` with BytesIO+write() in the diff and xmlstring paths
for consistency.
Fixes #2762
* test(xml): add integration test for DOCTYPE preservation
* feat(changelog): add fragment for xml DOCTYPE fix (#12148)
---------
(cherry picked from commit
|
||
|---|---|---|
| .. | ||
| ansible-xml-beers-unicode.xml | ||
| ansible-xml-beers-unicode.xml.license | ||
| ansible-xml-beers.xml | ||
| ansible-xml-beers.xml.license | ||
| ansible-xml-doctype.xml | ||
| ansible-xml-doctype.xml.license | ||
| ansible-xml-items.xml | ||
| ansible-xml-items.xml.license | ||
| ansible-xml-namespaced-beers.xml | ||
| ansible-xml-namespaced-beers.xml.license | ||