Class: Ansible::Ruby::Modules::Xml
- Inherits:
-
Base
- Object
- Ansible::Ruby::Models::Base
- Base
- Ansible::Ruby::Modules::Xml
- Defined in:
- lib/ansible/ruby/modules/generated/files/xml.rb
Overview
A CRUD-like interface to managing bits of XML files. You might also be interested in a brief tutorial from U(www.w3schools.com/xml/xpath_intro.asp) and U(developer.mozilla.org/en-US/docs/Web/XPath).
Instance Method Summary collapse
-
#add_children ⇒ Array<Hash>, ...
Add additional child-element(s) to a selected element for a given C(xpath).,Child elements must be given in a list and each item may be either a string (eg. C(children=ansible) to add an empty C(<ansible/>) child element), or a hash where the key is an element name and the value is the element value.,This parameter requires C(xpath) to be set.
-
#attribute ⇒ String?
The attribute to select when using parameter C(value).,This is a string, not prepended with C(@).
-
#backup ⇒ :yes, ...
Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly.
-
#content ⇒ :attribute, ...
Search for a given C(xpath) and get content.,This parameter requires C(xpath) to be set.
-
#count ⇒ :yes, ...
Search for a given C(xpath) and provide the count of any matches.,This parameter requires C(xpath) to be set.
-
#input_type ⇒ :xml, ...
Type of input for C(add_children) and C(set_children).
-
#namespaces ⇒ Hash?
The namespace C(prefix:uri) mapping for the XPath expression.,Needs to be a C(dict), not a C(list) of items.
-
#path ⇒ String
Path to the file to operate on.
-
#pretty_print ⇒ :yes, ...
Pretty print XML output.
-
#print_match ⇒ :yes, ...
Search for a given C(xpath) and print out any matches.,This parameter requires C(xpath) to be set.
-
#set_children ⇒ Object?
Set the child-element(s) of a selected element for a given C(xpath).,Removes any existing children.,Child elements must be specified as in C(add_children).,This parameter requires C(xpath) to be set.
-
#state ⇒ :absent, ...
Set or remove an xpath selection (node(s), attribute(s)).
-
#strip_cdata_tags ⇒ :yes, ...
Remove CDATA tags surrounding text values.,Note that this might break your XML file if text values contain characters that could be interpreted as XML.
-
#value ⇒ Integer, ...
Desired state of the selected attribute.,Either a string, or to unset a value, the Python C(None) keyword (YAML Equivalent, C(null)).,Elements default to no value (but present).,Attributes default to an empty string.
-
#xmlstring ⇒ Object
A string containing XML on which to operate.,This parameter is required, unless C(path) is given.
-
#xpath ⇒ String?
A valid XPath expression describing the item(s) you want to manipulate.,Operates on the document root, C(/), by default.
Methods inherited from Base
Methods inherited from Ansible::Ruby::Models::Base
attr_option, attr_options, attribute, #initialize, remove_existing_validations, #to_h, validates
Constructor Details
This class inherits a constructor from Ansible::Ruby::Models::Base
Instance Method Details
#add_children ⇒ Array<Hash>, ...
Returns Add additional child-element(s) to a selected element for a given C(xpath).,Child elements must be given in a list and each item may be either a string (eg. C(children=ansible) to add an empty C(<ansible/>) child element), or a hash where the key is an element name and the value is the element value.,This parameter requires C(xpath) to be set.
41 |
# File 'lib/ansible/ruby/modules/generated/files/xml.rb', line 41 attribute :add_children |
#attribute ⇒ String?
Returns The attribute to select when using parameter C(value).,This is a string, not prepended with C(@).
33 |
# File 'lib/ansible/ruby/modules/generated/files/xml.rb', line 33 attribute :attribute |
#backup ⇒ :yes, ...
Returns Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly.
68 |
# File 'lib/ansible/ruby/modules/generated/files/xml.rb', line 68 attribute :backup |
#content ⇒ :attribute, ...
Returns Search for a given C(xpath) and get content.,This parameter requires C(xpath) to be set.
60 |
# File 'lib/ansible/ruby/modules/generated/files/xml.rb', line 60 attribute :content |
#count ⇒ :yes, ...
Returns Search for a given C(xpath) and provide the count of any matches.,This parameter requires C(xpath) to be set.
48 |
# File 'lib/ansible/ruby/modules/generated/files/xml.rb', line 48 attribute :count |
#input_type ⇒ :xml, ...
Returns Type of input for C(add_children) and C(set_children).
64 |
# File 'lib/ansible/ruby/modules/generated/files/xml.rb', line 64 attribute :input_type |
#namespaces ⇒ Hash?
Returns The namespace C(prefix:uri) mapping for the XPath expression.,Needs to be a C(dict), not a C(list) of items.
25 |
# File 'lib/ansible/ruby/modules/generated/files/xml.rb', line 25 attribute :namespaces |
#path ⇒ String
Returns Path to the file to operate on. File must exist ahead of time.,This parameter is required, unless C(xmlstring) is given.
13 |
# File 'lib/ansible/ruby/modules/generated/files/xml.rb', line 13 attribute :path |
#pretty_print ⇒ :yes, ...
Returns Pretty print XML output.
56 |
# File 'lib/ansible/ruby/modules/generated/files/xml.rb', line 56 attribute :pretty_print |
#print_match ⇒ :yes, ...
Returns Search for a given C(xpath) and print out any matches.,This parameter requires C(xpath) to be set.
52 |
# File 'lib/ansible/ruby/modules/generated/files/xml.rb', line 52 attribute :print_match |
#set_children ⇒ Object?
Returns Set the child-element(s) of a selected element for a given C(xpath).,Removes any existing children.,Child elements must be specified as in C(add_children).,This parameter requires C(xpath) to be set.
45 |
# File 'lib/ansible/ruby/modules/generated/files/xml.rb', line 45 attribute :set_children |
#state ⇒ :absent, ...
Returns Set or remove an xpath selection (node(s), attribute(s)).
29 |
# File 'lib/ansible/ruby/modules/generated/files/xml.rb', line 29 attribute :state |
#strip_cdata_tags ⇒ :yes, ...
Returns Remove CDATA tags surrounding text values.,Note that this might break your XML file if text values contain characters that could be interpreted as XML.
72 |
# File 'lib/ansible/ruby/modules/generated/files/xml.rb', line 72 attribute :strip_cdata_tags |
#value ⇒ Integer, ...
Returns Desired state of the selected attribute.,Either a string, or to unset a value, the Python C(None) keyword (YAML Equivalent, C(null)).,Elements default to no value (but present).,Attributes default to an empty string.
37 |
# File 'lib/ansible/ruby/modules/generated/files/xml.rb', line 37 attribute :value |
#xmlstring ⇒ Object
Returns A string containing XML on which to operate.,This parameter is required, unless C(path) is given.
17 |
# File 'lib/ansible/ruby/modules/generated/files/xml.rb', line 17 attribute :xmlstring |
#xpath ⇒ String?
Returns A valid XPath expression describing the item(s) you want to manipulate.,Operates on the document root, C(/), by default.
21 |
# File 'lib/ansible/ruby/modules/generated/files/xml.rb', line 21 attribute :xpath |