Help with string replacement in xml

Hi,

I am a newbie and would like to know how I can change the contents of
the xml files with Ruby.

In pom.xml,

  <parent>
    <groupId>com.sports.storage.build.super-pom</groupId>
    <artifactId>storeage-pom</artifactId>
    <version>1.2.3.4</version>
  </parent>

   <dependency>
      <groupId>com.sports.basketball</groupId>
      <artifactId>branding</artifactId>
      <type>foundation-component</type>
      <version>2.6.6.7</version>
    </dependency>

1. How can i find parent|groupID|artifactID|version, then change
"1.2.3.4" to "1.2.3.5"?
2. How can i find dependency|groupId|artifactId|type|version, then
change "2.6.6.7" to "2.6.6.8"?

Thanks.

B.