{"action":"created","issue":{"url":"https://api.github.com/repos/cmprescott/ansible-xml/issues/70","repository_url":"https://api.github.com/repos/cmprescott/ansible-xml","labels_url":"https://api.github.com/repos/cmprescott/ansible-xml/issues/70/labels{/name}","comments_url":"https://api.github.com/repos/cmprescott/ansible-xml/issues/70/comments","events_url":"https://api.github.com/repos/cmprescott/ansible-xml/issues/70/events","html_url":"https://github.com/cmprescott/ansible-xml/issues/70","id":161512335,"number":70,"title":"pretty_print for attributes","user":{"login":"Hubbitus","id":720349,"avatar_url":"https://avatars2.githubusercontent.com/u/720349?v=4","gravatar_id":"","url":"https://api.github.com/users/Hubbitus","html_url":"https://github.com/Hubbitus","followers_url":"https://api.github.com/users/Hubbitus/followers","following_url":"https://api.github.com/users/Hubbitus/following{/other_user}","gists_url":"https://api.github.com/users/Hubbitus/gists{/gist_id}","starred_url":"https://api.github.com/users/Hubbitus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hubbitus/subscriptions","organizations_url":"https://api.github.com/users/Hubbitus/orgs","repos_url":"https://api.github.com/users/Hubbitus/repos","events_url":"https://api.github.com/users/Hubbitus/events{/privacy}","received_events_url":"https://api.github.com/users/Hubbitus/received_events","type":"User","site_admin":false},"labels":[{"id":81740796,"url":"https://api.github.com/repos/cmprescott/ansible-xml/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-06-21T18:51:15Z","updated_at":"2017-09-01T12:04:38Z","closed_at":null,"author_association":"NONE","body":"Hello.\n\nI have tomcat context file which looks like:\n\n``` xml\n<?xml version='1.0' encoding='utf-8'?>\n<Context>\n\n    <Resource type=\"javax.sql.DataSource\"\n              name=\"jdbc/UniDataDataSource\"\n              description=\"UniData Database\"\n              factory=\"org.apache.tomcat.jdbc.pool.DataSourceFactory\"\n              driverClassName=\"org.postgresql.Driver\"\n              url=\"jdbc:postgresql://localhost:5432/unidata\"\n              username=\"postgres\"\n              password=\"postgres\"\n              initialSize=\"10\"\n              maxActive=\"100\"\n              maxIdle=\"50\"\n              minIdle=\"10\"\n              suspectTimeout=\"60\"\n              timeBetweenEvictionRunsMillis=\"30000\"\n              minEvictableIdleTimeMillis=\"60000\"\n              testOnBorrow=\"true\"\n              validationQuery=\"SELECT 1\"\n              validationInterval=\"30000\"\n              removeAbandoned=\"true\"\n              removeAbandonedTimeout=\"180\"\n              logAbandoned=\"true\"\n              abandonWhenPercentageFull=\"50\"\n              jdbcInterceptors=\"ResetAbandonedTimer\" />\n\n</Context>\n```\n\nI want change their attributes, but do not loose formatting. Is it possible?\n\nMy playbook similar to (simplified):\n\n``` yml\n    - name: Provide database access to tomcat\n      xml:\n        file: context.xml.default\n        pretty_print: True\n        xpath: /Context/Resource[@name='{{item.name}}']\n        attribute: \"{{item.attribute}}\"\n        value: \"{{item.value}}\"\n      with_items:\n        - { name: 'jdbc/UniDataDataSource', attribute: url, value: 'test_attribute_value' }\n```\n\nAnd result in one string:\n\n``` xml\n<?xml version='1.0' encoding='UTF-8'?>\n<Context>\n  <Resource type=\"javax.sql.DataSource\" name=\"jdbc/UniDataDataSource\" description=\"UniData Database\" factory=\"org.apache.tomcat.jdbc.pool.DataSourceFactory\" driverClassName=\"org.postgresql.Driver\" url=\"test_attribute_value\" username=\"postgres\" password=\"postgres\" initialSize=\"10\" maxActive=\"100\" maxIdle=\"50\" minIdle=\"10\" suspectTimeout=\"60\" timeBetweenEvictionRunsMillis=\"30000\" minEvictableIdleTimeMillis=\"60000\" testOnBorrow=\"true\" validationQuery=\"SELECT 1\" validationInterval=\"30000\" removeAbandoned=\"true\" removeAbandonedTimeout=\"180\" logAbandoned=\"true\" abandonWhenPercentageFull=\"50\" jdbcInterceptors=\"ResetAbandonedTimer\"/>\n</Context>\n```\n\nI understand what it is `Resource` tag with many attributes and no child elements. It there any possibility preserve formatting similar to initial state?\n"},"comment":{"url":"https://api.github.com/repos/cmprescott/ansible-xml/issues/comments/326563438","html_url":"https://github.com/cmprescott/ansible-xml/issues/70#issuecomment-326563438","issue_url":"https://api.github.com/repos/cmprescott/ansible-xml/issues/70","id":326563438,"user":{"login":"dagwieers","id":388198,"avatar_url":"https://avatars0.githubusercontent.com/u/388198?v=4","gravatar_id":"","url":"https://api.github.com/users/dagwieers","html_url":"https://github.com/dagwieers","followers_url":"https://api.github.com/users/dagwieers/followers","following_url":"https://api.github.com/users/dagwieers/following{/other_user}","gists_url":"https://api.github.com/users/dagwieers/gists{/gist_id}","starred_url":"https://api.github.com/users/dagwieers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dagwieers/subscriptions","organizations_url":"https://api.github.com/users/dagwieers/orgs","repos_url":"https://api.github.com/users/dagwieers/repos","events_url":"https://api.github.com/users/dagwieers/events{/privacy}","received_events_url":"https://api.github.com/users/dagwieers/received_events","type":"User","site_admin":false},"created_at":"2017-09-01T12:04:38Z","updated_at":"2017-09-01T12:04:38Z","author_association":"COLLABORATOR","body":"This issue was moved to ansible/ansible#28920"}}
{"actor":{"display_login":"dagwieers"}}