Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using DOM to set the value of a tag.

 
igwe kalu kalu ogba
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I have an XML file and want to be able to edit it's tags:, This is what my document looks like:


<datasources>
<local-tx-datasource>
<jndi-name>SelfServiceDB1</jndi-name>
<connection-url>jdbc:microsoft:sqlserver://specs-dev:1433;SelectMethod=cursor;DataBaseName=gtb;</connection-url>
<driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
<user-name>gtb</user-name>
<password>gtb</password>
<min-pool-size>5</min-pool-size>
<max-pool-size>100</max-pool-size>
<blocking-timeout-millis>5000000</blocking-timeout-millis>
<idle-timeout-minutes>1</idle-timeout-minutes>
<!--<security-domain>ESSDbRealm</security-domain>-->
</local-tx-datasource>

<local-tx-datasource>
<jndi-name>ErecruitmentDB</jndi-name>
<connection-url>jdbc:microsoft:sqlserver://specs-dev:1433;SelectMethod=cursor;</connection-url>
<driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
<user-name>ess</user-name>
<password>ess</password>
<min-pool-size>5</min-pool-size>
<max-pool-size>100</max-pool-size>
<idle-timeout-minutes>1</idle-timeout-minutes>
<blocking-timeout-millis>5000000</blocking-timeout-millis>
<!--<security-domain>ErecruitDbRealm</security-domain>-->
</local-tx-datasource>

</datasources>

I want to be able to change the values of tags such as user-name, password and min-pool-size e.t.c. How do I do this using DOM. I am able to use DOM to setAttributes e.t.c. How do I set the value of a tag and not it's attribute. Also, since this xml file contains a number of <local-tx-datasource> element tags, how do I select which particular tag I want to edit. thank you.
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a tutorial in ibm developers site called "Understanding DOM", that would help you to get started.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic