From d0f1d9efd916eba4c9dcd8b9a26d94ae43ace8f5 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Thu, 27 May 2021 20:19:39 +0200 Subject: [PATCH] xml: Add an example for absent (#2644) (#2655) Element node can be deleted based upon the attribute value. Signed-off-by: Abhijeet Kasurde (cherry picked from commit 795125fec4d4b9875ea1c29a6ccd81c30432b4c7) Co-authored-by: Abhijeet Kasurde --- plugins/modules/files/xml.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/plugins/modules/files/xml.py b/plugins/modules/files/xml.py index f93c8e4dc4..e7c6ca3f1e 100644 --- a/plugins/modules/files/xml.py +++ b/plugins/modules/files/xml.py @@ -301,6 +301,23 @@ EXAMPLES = r''' - floor: Grog storage - construction_date: "1990" # Only strings are valid - building: Grog factory + +# Consider this XML for following example - +# +# +# +# part to remove +# +# +# part to keep +# +# + +- name: Delete element node based upon attribute + community.general.xml: + path: bar.xml + xpath: /config/element[@name='test1'] + state: absent ''' RETURN = r'''