XML File Generation from Within Salesforce B2C Commerce

Standard exports use the B2C Commerce-defined XML schema files. B2C Commerce provides a set of schema files (located on B2C Commerce XChange) that can be used to create the most common export files.

You can also import product and content images in a .zip file and export analytics data in xls format

The typical B2C Commerce implementation includes generating XML documents for data transfer to a back end system.

To create an XML document from data in the system, the standard practice is to create code that iterates over data in B2C Commerce and outputs this data to an XML file.

If you need to write custom code, you need to think about how many objects or how much XML to read into memory, how many objects to read before committing the transaction, and other constraints that are taken care of automatically with the standard feeds.

For example, if you are post-processing an order export into a proprietary XML format for a backend system, consider whether it make sense to use a B2C Commerce script. It might be faster and more efficient to transform a file using a pure .NET or a Java platform with a large amount of memory allocated to the processing.

However, if you want to use a B2C Commerce script, you will likely use the XMLStreamReader and getXMLObject() method to get a specific order within the export file and then use nextTag() to iterate through elements in the order and XMLStreamWriter to write out the order to the new file.

It isn't a good idea to read an entire export file or entire order into memory before writing it out using the XMLStreamWriter, as it can cause an out of memory error.