This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Using DOM  to set the value of a tag. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Using DOM  to set the value of a tag." Watch "Using DOM  to set the value of a tag." New topic
Author

Using DOM to set the value of a tag.

igwe kalu kalu ogba
Ranch Hand

Joined: Feb 03, 2005
Posts: 133
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

Joined: Jul 13, 2001
Posts: 3150
There is a tutorial in ibm developers site called "Understanding DOM", that would help you to get started.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using DOM to set the value of a tag.
 
Similar Threads
Jboss connection pool not releasing the connection from pool
[JCA/JBOSS] Change the default Hypersonic to Oracle
Jboss, connection problem
Unable to obtain datasource
connection pool with jboss