Newer Version Available

This content describes an older version of this product. View Latest

Writing XML Using Streams

The XmlStreamWriter class methods enable the writing of XML data.
Those methods are used in conjunction with HTTP callouts to construct an XML document to send in the callout request to an external service. The following example shows how to instantiate a new XmlStreamReader object:

XML Writer Methods Example

The following example writes an XML document and tests its validity.

The Hello World and the shipping invoice samples require custom fields and objects. You can either create these on your own, or download the objects, fields and Apex code as a managed packaged from Force.com AppExchange. For more information, see https://developer.salesforce.com/docs.

Note