I am trying to edit one attribute inside of a relatively large xml file using vbs. I am getting errors wheneverI try to use the selectSingleNode operation I am getting errors. This a shortened xml file that should give all of the information needed. I need to edit the of the root-logger node to be WARN instead of INFO
<?xml version="1.0" encoding="UTF-8"?>
<server xmlns="urn:jboss:domain:1.2">
<extensions>
<extension module="org.jboss.as.clustering.infinispan"/>
<extension module="org.jboss.as.cmp"/>
<extension module="org.jboss.as.configadmin"/>
<extension module="org.jboss.as.connector"/>
<extension module="org.jboss.as.deployment-scanner"/>
<extension module="org.jboss.as.ee"/>
<extension module="org.jboss.as.ejb3"/>
<extension module="org.jboss.as.jacorb"/>
<extension module="org.jboss.as.jaxr"/>
<extension module="org.jboss.as.jaxrs"/>
<extension module="org.jboss.as.jdr"/>
<extension module="org.jboss.as.jmx"/>
<extension module="org.jboss.as.jpa"/>
<extension module="org.jboss.as.jsr77"/>
<extension module="org.jboss.as.logging"/>
</extensions>
<management>
<security-realms>
<security-realm name="ManagementRealm">
<authentication>
<properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/>
</authentication>
</security-realm>
<security-realm name="ApplicationRealm">
<authentication>
<properties path="application-users.properties" relative-to="jboss.server.config.dir"/>
</authentication>
</security-realm>
</security-realms>
<management-interfaces>
<native-interface security-realm="ManagementRealm">
<socket-binding native="management-native"/>
</native-interface>
<http-interface security-realm="ManagementRealm">
<socket-binding http="management-http"/>
</http-interface>
</management-interfaces>
</management>
<profile>
<subsystem xmlns="urn:jboss:domain:logging:1.1">
<logger category="com.arjuna">
<level name="WARN"/>
</logger>
<logger category="org.apache.tomcat.util.modeler">
<level name="WARN"/>
</logger>
<root-logger>
<level name="INFO"/>
<handlers>
<handler name="CONSOLE"/>
<handler name="FILE"/>
</handlers>
</root-logger>
</subsystem>
</profile>
</server>
the script I am trying to use to edit the file looks like this
set xml = CreateObject("Microsoft.XMLDOM")
xml.async = false
xml.validateOnParse = false
xml.resolveExternals = false
xml.setProperty "SelectionLanguage", "XPath"
xml.setProperty "SelectionNamespaces", "xmlns:m='urn:jboss:domain:logging:1.1'"
slog4j = "WARN"
err.clear
on error resume next
xml.load (WScript.arguments(0))
if (err.number = 0) then
xml.selectSingleNode("//profile/subsystem/root-logger/level/@").text = slog4j
strResult = xml.save(WScript.arguments(0))
end if
It seems to be reading in the xml file correctly and having a problem with the xpath location to get to the attribute, but I used a similar format that worked on a previous file. Any suggestions would be wonderful. Sorry for the long block of code for the xml file. I didnt know how much i could remove while still giving enough information to get some help