The ATG platform includes four servlet beans that let you create and manipulate DOM components:

  • XMLToDOM: Parses an XML document and transforms it into a DOM document, so the document’s nodes and attributes are available as objects and object properties.

  • NodeForEach: Given a DOM node, selects nodes that match a specified pattern and iterates over the selected nodes.

  • NodeMatch: Given a DOM node, selects the next node that matches a specified pattern.

  • XMLTransform: Given an XML document and an XSLT or JSP template, transforms and outputs the XML document, with the formatting provided by the template.

You can also accomplish these tasks with a non ATG-specific tag library such as Apache Xtags (http://jakarta.apache.org/taglibs/doc/xtags-doc/intro.html).

For example, an extranet application might let clients view the status of orders that are fulfilled through a supply chain. Because the supply chain can involve other companies, you establish a standard XML format to communicate order status via documents like this:

<?xml version="1.0"?>

<widget-orders version="1">

<order id="ID101010" account="86666">
  <order-status>
     "Shipped"
  </order-status>
</order>

<order id="ID939393" account="86667">
   <order-status>
     "Awaiting shipment"
   </order-status>
</order>

<order id="ID101011" account="86666">
  <order-status>
     "Shipped"
  </order-status>
</order>

</widget-orders>

In this example, the XML document is composed of several order nodes. Each node has two attributes:

  • id identifies the order.

  • account identifies the customer who placed the order.

Each order node has an orderstatus child node, which defines the order’s status.

Note: This XML document omits an encoding declaration because it uses the default iso-8859-1 encoding. A document that uses another character encoding must include an encoding declaration. For example, if the document uses the UTF encoding, the first line must be:

<?xml version="1.0" encoding="UTF8"?>

For more information about character encoding, see the ATG Platform Programming Guide.


Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices