Hi all lets assume a sample POM.xml file ,
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<groupId>com.xyz.app</groupId>
<artifactId>com.xyz.app</artifactId>
<version>1.0.55-SNAPSHOT</version>
<dependencies>
<!-- Compile Dependencies -->
<dependency>
<groupId>com.xyz.app</groupId>
<artifactId>com.xyz.app.random1</artifactId>
<version>1.0.2-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.xyz.app</groupId>
<artifactId>com.xyz.app.random2</artifactId>
<version>1.0.7-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.xyz.app</groupId>
<artifactId>com.xyz.random3</artifactId>
<version>1.0.2-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.xyz.app</groupId>
<artifactId>com.xyz.app.random4</artifactId>
<version>1.0.7-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
`
Now i want to update the version of the dependencies to the latest one . I have the latest depndencies in a dictionary where the key is the dependencies and the values is the latest version .
Now i am trying to access each dependency element using the following code
root = etree.parse("C:\Temp\python workspace\pom.xml")
root = etree.tostring(root)
root = etree.XML(root)
for parent in root.xpath('//dependency'):
children = parent.getchildren()
for child in children:
print child.text
But i'am not getting any output , could some one point out what i'am doing wrong here ?