I get data in XML from a web service from a connector URL, the xml contains data about people, now I have to read the names, emailids from that xml and compare with my org's contacts and so some operations. So how do I read it?


You need either Dom or XmlStreamReader class to parse your xml response. You can find sample code in the below links.

Xml parsing using XmlStreamReader:- https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_xml_streaming_reading.htm

Xml parsing using Dom:- https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_xml_dom.htm

| improve this answer | |
  • 3
    Please do not post link only answers as they can lose their value if the links break, include a bit of relevant information from the linked site. – Dave Humm Oct 5 '16 at 5:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.