-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add hierarchy of xml elements from yaml structure #95
Comments
Look at the example at #101, the same technique is possible for adding multiple levels. Using the YAML input type: - xml:
file: /tmp/test156.new.xml
xpath: /List
pretty_print: yes
add_children:
- Item:
_Id: id002
_:
- Label:
_:
- Name: Demo 2
- Source: Vinyl
- Active: "0" Using the XML input type: - xml:
file: /tmp/test156.new.xml
xpath: /List
input_type: xml
pretty_print: yes
add_children:
- "<Item id='id002'><Label><Name>Demo 2</Name><Source>Vinyl</Source></Label><Active>0</Active></Item>" If you're happy with these examples, please close this issue :-) |
@sradi Please provide feedback and/or close this issue. |
Thanks for the help. That looks helpful! :) |
@dagwieers' examples are wonderful -- and did help me finish my project -- but why is not there anything of the kind in the xml-module's official documentation? All of the examples there show merely, how to set individual values... Update: Changed link above to latest development docs |
@UnitedMarsupials I think we didn't add all examples from the integration tests because there would be too many examples in the module's documentation. But maybe we should add a section in the Ansible documentation related to the xml module functionality ? If you think this is something you'd like to contribute, let me know. |
I added a TODO item on the community wiki with links to the original README and the integration tests: https://github.com/ansible/community/wiki/Module:-xml#todo |
Hi,
I am currently trying out ansible-xml. There's one thing, I couldn't get working:
I am referencing a variable from a yml file, which contains a list of items, that are added as xml elements to my target file. That's easy... Now I would like to reference a variable, which contains a list, where each item again contains a list. I expected, that I could add two levels of nested xml elements at once, this way. Unfortunately I am receiving this error:
TypeError: Argument must be bytes or unicode, got 'list'
Is there any way to add a full xml structure at once, with add_children?
Thanks a lot in advance!!
Stefan
The text was updated successfully, but these errors were encountered: