--- # Copyright (c) Ansible Project # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) # SPDX-License-Identifier: GPL-3.0-or-later - name: Count nodes in an XML string xml_info: xmlstring: "{{ xml_info_test_xml }}" xpath: /business/beers/beer count: true register: count_result - name: Test expected result assert: that: - count_result is not changed - count_result.count == 3 - name: Get element text from an XML string xml_info: xmlstring: "{{ xml_info_test_xml }}" xpath: /business/rating content: text register: text_result - name: Test expected result assert: that: - text_result is not changed - text_result.matches[0]['rating'] == '10' - name: Print match from an XML string xml_info: xmlstring: "{{ xml_info_test_xml }}" xpath: /business/beers/beer print_match: true register: match_result - name: Test expected result assert: that: - match_result is not changed - match_result.matches | length == 3