Updating to axiom-impl from 1.3.0 to 1.4.0

237 Views Asked by At

I'm updating the lib org.apache.ws.commons.axiom:axiom-impl from version 1.3.0 to 1.4.0. After the update the class org.apache.axiom.om.impl.llom.OMAttributeImpl does not exist anymore.

From the release notes the change is maybe indirect mentioned as internal refactoring. Inside the GitHub project I can not find the class anymore.

The question which arises for me, how can I modifiy this code that it works as expected?

   if (element != null) {
        OMAttribute attribute = new OMAttributeImpl();
        attribute.setLocalName("localName");
        attribute.setAttributeValue("1");
        element.addAttribute(attribute);

Thanks in advance, Markus

1

There are 1 best solutions below

0
Andreas Veithen On

The problem here is that the code directly refers to the implementation class of the OMAttribute interface. That's an internal implementation detail. Instead, either

  • create the OMAttribute instance using the createOMAttribute method defined by OMFactory,
  • or simply write element.addAttribute("localName", "1", null).