I have this XML file /opt/webapp/config.xml for a custom webapp that contains a parent node items.
<items>
</items>
I'm trying to add a list of new child nodes item with an attribute value while making sure the child node doesn't contain the end/closing tag because the app requires that format.
<items>
<item value="video/*"/><item value="audio/*"/><item value="application/rar"/><item value="application/x-zip"/><item value="application/x-gzip"/>
</items>
If I were to open up the existing configuration using augtool, I will get the below output.
/files/opt/webapp/config.xml/File/FileTypes
/files/opt/webapp/config.xml/File/FileTypes/#text = "\n"
/files/opt/webapp/config.xml/File/FileTypes/items
/files/opt/webapp/config.xml/File/FileTypes/items/#text = "\n"
/files/opt/webapp/config.xml/File/FileTypes/items/item[1] = "#empty"
/files/opt/webapp/config.xml/File/FileTypes/items/item[1]/#attribute
/files/opt/webapp/config.xml/File/FileTypes/items/item[1]/#attribute/value = "video/*"
/files/opt/webapp/config.xml/File/FileTypes/items/item[2] = "#empty"
/files/opt/webapp/config.xml/File/FileTypes/items/item[2]/#attribute
/files/opt/webapp/config.xml/File/FileTypes/items/item[2]/#attribute/value = "audio/*"
/files/opt/webapp/config.xml/File/FileTypes/items/item[3] = "#empty"
/files/opt/webapp/config.xml/File/FileTypes/items/item[3]/#attribute
/files/opt/webapp/config.xml/File/FileTypes/items/item[3]/#attribute/value = "application/rar"
I found a few posts here and here discussing about xml and Augeas but those examples follow the format with both starting and closing tag. For example: <item value="application/rar"></item>
. And I'm trying to find a way to see if Augeas can also create and add child node with a self-closing tag only.
I'm using augtool (version 1.10.1) that comes with puppet agent 5.5.10 on RHEL 7.
Thank you.