Search code examples
javaxmlsun

Java API Equivalent of Sun Object


Running static analysis on my code it was pointed out that I shouldn't use Sun classes and use Java APIs instead.

What would be the correct Java API equivalent of the following code:

DeferredElementNSImpl nodes = (DeferredElementNSImpl) node;
Node transactionID = nodes.getElementsByTagName("id").item(0);

Where node is of type org.w3c.dom.Node


Solution

  • You should cast node to org.w3c.dom.Element.