method
to_xml
v2.0.3 -
Show latest stable
-
0 notes -
Class: ActiveResource::Base
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3 (0)
- 2.1.0 (0)
- 2.2.1 (0)
- 2.3.8 (16)
- 3.0.0 (-38)
- 3.0.9 (0)
- 3.1.0 (0)
- 3.2.1 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1
- 5.1.7
- 5.2.3
- 6.0.0
- 6.1.3.1
- 6.1.7.7
- 7.0.0
- 7.1.3.2
- 7.1.3.4
- What's this?
to_xml(options={})
public
A method to convert the the resource to an XML string.
Options
The options parameter is handed off to the to_xml method on each attribute, so it has the same options as the to_xml methods in ActiveSupport.
indent: | Set the indent level for the XML output (default is 2). |
dasherize: | Boolean option to determine whether or not element names should replace underscores with dashes (default is false). |
skip_instruct: | Toggle skipping the instruct! call on the XML builder that generates the XML declaration (default is false). |
Examples
my_group = SubsidiaryGroup.find(:first) my_group.to_xml # => <?xml version="1.0" encoding="UTF-8"?> # <subsidiary_group> [...] </subsidiary_group> my_group.to_xml(:dasherize => true) # => <?xml version="1.0" encoding="UTF-8"?> # <subsidiary-group> [...] </subsidiary-group> my_group.to_xml(:skip_instruct => true) # => <subsidiary_group> [...] </subsidiary_group>