MAVEN SOLUTION:
Adding this version of the dependency to the pom.xml (if using maven) worked for me:
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
</dependency>
SOLUTION FOR EVERYONE ELSE:
If not using maven, you can manually add the xml-apis library, version 1.4.01. You will find the jars inside the xml-commons binary package, and you can download it here: http://xerces.apache.org/mirrors.cgi. Finally compile and execute your java application/project with this version of the library.
Explanation:
The 1.4.01 version of the xml-apis library, includes the required ElementTraversal class. Other versions like 2.0.0, 1.0.0, etc. do not include it, and the application fails while compiling.