Reputation: 1492
I am trying to get the data inside of a CDATA SOAP Element.
To do so, I have followed the instructions provided by How can SOAPMessage parse <![CDATA[ ]]>?.
This and other examples require me to use the following code segments:
SOAPBody soapBody = soapMessage.getSOAPBody();
NodeList nodeList = soapBody.getElementsByTagName("outerElementOfCDATA");
Element element = (Element) nodeList.item(0);
Node child = element.getFirstChild();
String characterData;
if (child instanceof CharacterData) {
characterData = ((CharacterData) child).getData();
}
However, when I try to use "instanceof CharacterData", I get an error saying CharacterData is not visible. (For reference: I am getting this information from eclipse)
It doesn't make any sense to me. Any suggestions?
Upvotes: 1
Views: 1291
Reputation: 1492
Update (I searched more thoroughly and found an answer):
import org.w3c.dom.CharacterData;
Don't use the standard CharacterData from java.lang.
Upvotes: 3