0

I'm trying to parse a string object that carries simple XML.

I have parsed XML files at the past but I can't use the code because it refers to files and not strings- please review the code I used for files and let me know how can I parse the same way string object

code example:

DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse( GET_XML.toString());
doc.getDocumentElement().normalize();

xml example:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TccSubscriptionData xmlns="tcc.generated.interfaces.com">
    <MessageKey>
        <MessageKey>12</MessageKey>
        <Receiver>sc</Receiver>
        <Timestamp>2018-06-20T14:33:22.968+02:00</Timestamp>
        <ResponseType>Subscription</ResponseType>
        <CorrelationId>0</CorrelationId>
    </MessageKey>
</TccSubscriptionData>
Roei Givati
  • 39
  • 1
  • 5

0 Answers0