Forum Stats

  • 3,837,916 Users
  • 2,262,307 Discussions
  • 7,900,431 Comments

Discussions

Unable to convert XML Stream Events Namespace to XML Stream Events Attribute in Java 11.0.5

4094494
4094494 Member Posts: 2
edited Nov 11, 2019 3:24AM in Java Technology & XML

ERROR:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project abc : Compilation failure

[ERROR] abc.java:[128,32] incompatible types: java.util.Iterator<javax.xml.stream.events.Namespace> cannot be converted to java.util.Iterator<javax.xml.stream.events.Attribute>

CODE:

StartElement ele = (StartElement) xmleve;Iterator<Attribute> ite = ele.getAttributes();while (ite.hasNext()) {          Attribute attr = ite.next();          element.setAttribute(attr.getName().getLocalPart(),              attr.getValue());        }String xmlns = EwsUtilities.WSTrustFebruary2005Namespace;//"http://schemas.xmlsoap.org/wsdl/";ite = ele.getNamespaces();

ele.getNamespaces() is returning above mentioned error

NOTE:

The above mentioned error occured in OpenJDK version 11.0.5 but not in OpenJDK versions 1.7 & 1.8.