Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

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

4094494Nov 11 2019 — edited Nov 11 2019

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.

Comments
Post Details
Added on Nov 11 2019
0 comments
350 views