The ATG platform provides tools for creating and working with XML Schemas for the XML documents written and read by the various data binding services. XML Schema is a schema language for XML that describes and restricts what a particular XML instance document might look like. An XML document can be validated against an XML Schema to check that it conforms to that Schema. Additionally, many developer tools make use of XML Schemas. For example, some tools provide a visual representation of XML Schemas to allow mapping from one XML Schema to another.
Generating XML Schemas
The ATG platform provides a command-line tool that generates an XML Schema for a given item descriptor. The XML generated by the Get data binding service conforms to this Schema. Similarly, the XML Schema describes an instance document that is capable of being processed by the Add, Update, or Remove service.
The command-line tool is named generateXMLSchema.sh
(on Unix) or generateXMLSchema.bat
(on Windows) and is found in the <ATG9dir>/home/bin
directory. The following table lists the arguments that can be supplied to this command:
| Nucleus path to the repository containing the item descriptor that the XML Schema is being generated for. Required. |
| Name of the item-descriptor that the XML Schema is being generated for. Required. |
| Specifies a directory to save the XML Schema to. This directory is in addition to the directory specified by the |
| If set to |
| Specifies the mapping file to use. Not required. |
| Nucleus path to the Schema Generator component. If omitted, defaults to |
| Specifies the set of modules to use in the repository definition. Required. |
| Prints out a usage message. Not required. |
Example
The following command generates an XML Schema for the user
item descriptor of the default Dynamo profile repository, using the properties defined in the repository definition file for the DSSJ2EEDemo
application module (and the modules required by the DSSJ2EEDemo
module):
generateXMLSchema -m DSSJ2EEDemo –repository
/atg/userprofiling/ProfileAdapterRepository -itemDescriptor user
The generated XML Schema is saved by the Schema Manager specified by the schemaManager
property of the Schema Generator component. The default Schema Generator is the /atg/repository/xml/SchemaGenerator
component, and its schemaManager
property points by default to the /atg/repository/xml/SchemaManager
component. Note that if the user
item descriptor contains other item descriptors as properties, the generated Schema will reflect these other item descriptors as well.
To save the Schema to the current working directory in addition to the directory determined by the XMLSchemaFileDirectory
property of the Schema Manager:
generateXMLSchema -m DSSJ2EEDemo –repository
/atg/userprofiling/ProfileAdapterRepository -itemDescriptor user
-outputDirectory .