Combining XML in ATG

250/365 - Bricks

(Photo: 250/365 – Bricks by Kenny Louie)

ATG uses XML files sometimes instead of Java properties files for configuration. Combining them is not as straight-forward as with Java properties files but more flexible.

The XML File Combination section in the Nucleus: Organizing JavaBean Components chapter of the ATG Programming guide gives a good explanation. You can combine XML files using one of these methods.

  • replace
  • remove
  • append
  • append-without-matching
  • prepend
  • prepend-without-matching

In most cases you will append which is what ATG does by default if the tag is not already there. If the tag is already there then ATG does a replace by default.

Note that when you do a replace you only need to specify the bare minimum. But what is the bare minimum can be tricky. Here is a case where we made a property hidden. Note that I had to specify the table type as “multi” otherwise ATG assumed it was “auxiliary” even though it’s defined as “multi” in the original XML file.
[xml]<table name="foo" type="multi">
  <property name="bar" hidden="true" />
</table>[/xml]
In another case I wanted to update the id-spaces for orders but I had to first remove before appending because replace did not work in this case. This is how I did it.
[xml]<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<id-spaces>
<id-space xml-combine="remove" name="order" seed="1" batch-size="10000" prefix="o"/>
<id-space name="order" seed="100" batch-size="1" prefix="m"/>
</id-spaces>[/xml]
To see the result of XML combining you can use the Dynamo Administration Server’s Component Browser to go to the component and then click on the property which specifies the XML file(s).

For example to find the result of combining idspaces.xml’s you would go to http://localhost:8080/dyn/admin/nucleus/atg/dynamo/service/IdGenerator/?propertyName=initialIdSpaces.

To find the result of combining productCatalogs.xml’s you would go to http://localhost:8080/dyn/admin/nucleus/atg/commerce/catalog/ProductCatalog/?propertyName=definitionFiles.

To find the result of combining commercepipeline.xml’s you would go to http://localhost:8080/dyn/admin/nucleus/atg/commerce/PipelineManager/?propertyName=definitionFile.