From 4b0d2dcfe04591d67c5cdf82599ac33156c221ce Mon Sep 17 00:00:00 2001 From: Daniel-Sanchez-Fabregas <33929811+Daniel-Sanchez-Fabregas@users.noreply.github.com> Date: Mon, 3 May 2021 07:42:58 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Document=20nested=20node=20addit?= =?UTF-8?q?ion=20with=20"=5F"=20in=20xml=20module=20(#2371)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 📝 Document nested node addition with "_" in xml module Nested node addition using "_" to indicate sub nodes, and attributes are only documented in tests and issues, where is hard to find. * 🚨 Fix trailing space * Apply suggestions from code review Add missing collection prefix for modules. Co-authored-by: Felix Fontein * Add missing comments * Update xml.py * Fix linter warnings Co-authored-by: Felix Fontein --- plugins/modules/files/xml.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/plugins/modules/files/xml.py b/plugins/modules/files/xml.py index df3562df8c..f93c8e4dc4 100644 --- a/plugins/modules/files/xml.py +++ b/plugins/modules/files/xml.py @@ -285,6 +285,22 @@ EXAMPLES = r''' z: http://z.test attribute: z:my_namespaced_attribute value: 'false' + +- name: Adding building nodes with floor subnodes from a YAML variable + community.general.xml: + path: /foo/bar.xml + xpath: /business + add_children: + - building: + # Attributes + name: Scumm bar + location: Monkey island + # Subnodes + _: + - floor: Pirate hall + - floor: Grog storage + - construction_date: "1990" # Only strings are valid + - building: Grog factory ''' RETURN = r'''