I have a Jboss host.xml
file that has the effective structure of
<host xmlns="urn:jboss:domain:1.5">
...
<domain-controller>
<remote host="${jboss.domain.master.address}" port="${jboss.domain.master.port:9999}" security-realm="ManagementRealm"/>
</domain-controller>
...
</host>
And am attempting to update the remote host using Etree
based on the first parameter passed into the script, however using the following code, its not even been able to find the domain-controller stanza
import xml.etree.ElementTree as ET
import sys
newhost=sys.argv[1]
tree = ET.parse('host.xml').getroot()
print len(tree.findall('domain-controller'))
for elem in tree.findall('domain-controller'):
print elem
oldhost = elem.find('./remote').text
print oldhosthost
oldhost.set('host','newhost')
I've been able to find the correct element using minidom
and getElementsByTagName
, but would rather work with Etree
as that seems to be the preferred approach.
Would someone mind telling me what I'm doing wrong?