Tech Home Publishers Advertisers
XML Transformation using JSP
This document details how a Private Label Partner using JSP on their site can translate an Aptimus XML offer stream for display. Aptimus can provide the offer stream in a variety of outputs, however due to the flexible nature of XML it is a preferred method.

Note that, the XML offer stream can be used for all forms of Private Label (Basic)   /  (Limited)  /   (Deep) depending on the level of integration intended by the Partner. For information on sending orders to Aptimus see the Order Action Specification.

Any partner who would like to use JSP code to transform XML offer data that they obtain from the Aptimus Network can now refer to the following sample file for guidance. Below is an explanation of the functionality involved in the JSP code, as well as links to the code, a live version and any miscellaneous documentation.

JSP Code Explanation
This sample uses JSP to transform XML offer data obtained from the Aptimus Network. There are no additional files, or XSL, used. The code uses a default URL, or generates one dynamically if parameters are passed on the request, to obtain an input stream. A parser is then obtained to parse the XML input stream into a DOM Document tree. Once the Document is obtained, the JSP loops through the tree and displays the offer data using methods available through the W3C DOM interfaces.

Any questions that also happen to appear on the request will appear as hidden questions in the generated page, so that when the page is submitted to the Aptimus Network’s data page, all of the parameters will be passed along as well.

The generated page can be displayed by following this link:
https://network.aptimus.com/AptiNet/samples/jsp/xmltest.jsp

To view the actual code, follow this link:
http://www.aptimus.com/technology/publishers/samples/jsp/viewfile.asp?file=xmltest.jsp

Notes and Miscellaneous Documentation
For this example, the Xerces Parser by Apache was used to parse the XML input stream, and abstract classes available through Sun were imported to obtain an instance of the DOM Document from the XML (both DOM and SAX parsers are supported). Below are links to the API's:

Please note that references to the following classes (or to the zip/jar files containing them) need to be on the ClassPath, as well as a reference to the parser being used, because they are imported into the JSP page for use within its code:

  • javax.xml.parsers.DocumentBuilder
  • javax.xml.parsers.DocumentBuilderFactory
  • javax.xml.parsers.ParserConfigurationException
  • java.net.*
  • java.io.*
  • org.w3c.dom.*

For Aptimus Publisher Use Only
©2007 All Rights Reserved
Last Updated 10/30/01