• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Using DOM to set the value of a tag.

 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is a tutorial in ibm developers site called "Understanding DOM", that would help you to get started.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic