📝 Document nested node addition with "_" in xml module (#2371)

* 📝 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 <felix@fontein.de>

* Add missing comments

* Update xml.py

* Fix linter warnings

Co-authored-by: Felix Fontein <felix@fontein.de>
pull/2417/head
Daniel-Sanchez-Fabregas 2021-05-03 07:42:58 +02:00 committed by GitHub
parent 7359b1fbe5
commit 4b0d2dcfe0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions

View File

@ -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'''