I have this string:

<FormSubmit><Field name="Patient.Email">test</Field></FormSubmit>

How can I parse that to an xml object so I can get the value from the patient.email field.



You could leverage the apex dom parser to parse XML or instantiate an XmlStreamReader.

Apex Dom Parser: http://developer.force.com/cookbook/recipe/parsing-xml-using-the-apex-dom-parser

XmlStreamReader Class: https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_xml_XmlStream_reader.htm

Both of these should work to get the patent.email. You will need to search by attributes in order to match Patent.Email. Let us know if you need any additional help.

| improve this answer | |
  • can you help me with a more concrete example? – Rodrigo Zurek Feb 18 '15 at 3:53

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.