From 795125fec4d4b9875ea1c29a6ccd81c30432b4c7 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Thu, 27 May 2021 22:34:52 +0530 Subject: [PATCH] xml: Add an example for absent (#2644) Element node can be deleted based upon the attribute value. Signed-off-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'''