Problem

How can I ensure my CDB XML or schema is correct without having to start the CDB?

Solution

Depending on your setup and on what you are doing, you can follow two strategies:

  • Use the ACS cdbChecker tool
  • Use an external XML validation tool. For example XML Spy.


Using the ACS cdbChecker

ACS provides a CDB validation tool. To use it on a complete CDB, set the ACS_CDB environment variable for the CDB to be validated and issue the command:


  • cdbChecker $ACS_CDB

Also, it can be used without parameters and cdbChecker will use $ACS_CDB by default.

To use it to validate a specific file or set of files:


  • cdbChecker file.xml

The -v (verbose) option is very convenient to see the details of the validation process. See the man page for more details.

p.s.: In this note we describe the improved and simplified syntax available since ACS 4.1.2.

Using XML Spy

XML Spy, a tool used to create XML schemas, is fantastic for verifying that XMLs are syntactically correct. Assuming you have XML Spy installed (ALMA has software licenses), there are only a couple of tasks that must be performed:

  1. Ensure the schema your XML is validating against is available to XML Spy. That is, it must exist on disk.
  2. Within your XML, add the xsi:schemaLocation attribute. The value of this attribute consists of the URN of the schema the XML is validating against followed by one space followed by the physical location of the schema on disk. A sample value could be:
    xsi:schemaLocation="urn:schemas-cosylab-com:EventChannel:1.0 E:\WORK\acsnc\ws\config\CDB\schemas\EventChannel.xsd"
  3. Next simply click the green checkmark button or press the F8 key to validate the schema.
  4. Before checking in the XML to the ALMA CVS repository, please be sure to remove the xsi:schemaLocation attribute as this has been known to give problems to the ACS CDB's XML parser/validator


-- DavidFugate - 17 Mar 2005