commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Dudley <sc...@telesoft.com>
Subject XMLConfiguration: Editing Root Node
Date Tue, 01 Jun 2010 23:32:23 GMT

I'm attempting to use XMLConfiguration to edit the Tomcat server.xml 
file.  I created a fragment with which to test:

<Server port="8005" shutdown="SHUTDOWN">
  <Service name="Catalina">
    <Connector connectionTimeout="20000" port="80" protocol="HTTP/1.1" 
redirectPort="8443"/>
  </Service>
</Server>

The following snippet first reads the Connector port and then sets both 
the Server and Connector ports to values based on same.

            XMLConfiguration xml = new 
XMLConfiguration("/home/scott/x.xml");
            int port = 
TFormatter.parseInt(xml.getString("Service.Connector[@port]"));  //80;
            xml.setProperty("[@port]", String.valueOf(6100+port));
            xml.setProperty("Service.Connector[@port]", 
String.valueOf(6000+port));
            // if i display the two properties at this point, they are 
as expected - 6180 and 6080
            xml.save();

The save does no overwrite the Server port.  It remains set to 8005.

What am I missing?

Many thanks.

-- 
Scott Dudley


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message