General XML Coding Requirements
As part of the on-boarding process, you receive XML schema files from your Implementation Consultant. Using those files and this document as a guide, you create the required XML documents for submission of your transactions. You should validate all XML you create using the supplied schema. Also, working with your Implementation Consultant, you are required to perform various tests of your XML (see Testing Your cnpAPI Transactions) prior to submitting transactions to the production environment.
In addition to the process outlined above, there are a few XML basics of which you should be aware.
- Encode all data using the UTF-8 format.
- Although it is not required, Worldpay recommends that when formatting your XML, you keep each element on its own line. This will aid in debugging situations where an error message specifies an issue in a particular line of XML code (for example, line 20).
- Be aware of special characters that require specific handling (see TABLE 1-3 Coding for Special Characters). For example, the less than (<) and greater than (>) symbols define element tags in the XML code. Using the entity names < and > instead of < and > prevents a browser from interpreting these characters as element brackets. Be sure to review data provided by customers for special character handling. For example, an address of "4th & Main," must be rewritten as "4th & Main" (including quotes) before being submitted via XML. Failure to quote this type of input causes rejection of XML submissions due to syntax errors.
TABLE 1-3 Coding for Special Characters
Entity Reference (case sensitive)