com.adobe.idml
Class Validator

java.lang.Object
  extended by com.adobe.idml.Validator

public class Validator
extends java.lang.Object

The Validator class can be used to validate IDML packages, extracted IDML packages, and non-package IDML files such as IDMS (snippets) and ICML (InCopy stories). Because non-package IDML files exist in a single file the class and documentation will referred to them as unified IDML file).

This class can be used programaticlly by contructing an Validator instance and calling one of three validate() methods on a given path.

You can construct an Validator with both types of schemas as follows:

Validator validator = new Validator("/MyFiles/PackageIDMLSchema", "/MyFiles/UnifiedIDMLSchema);

You also can us the more intelligent constructor that determines which type of schema you are loading and initializes the Validator with the appropriate schema type.

Validator validator = new Validator("/MyFiles/someIDMLSchema");

You could also use the setPackageSchema() and setUnifiedSchema() methods after construction.

Once an Validator is constructed you can validate using one of three methods. The validate method examines the file name and uses the appropriate schema type for validation. It's up to you to make sure that schema type is loaded. For example the following

validator.validate("/MyFiles/Hello.idml"); validator.validate("/MyFiles/Story.icml");

You can manually specify which type of schema to use via the following calls.

validator.validatePackage("/MyFiles/Hello.idml"); validator.validateUnifiedFile("/MyFiles/Hello/icml");

This class also provides a main method that uses the intelligent constructor and validate method. For example, it could be run as follows:

com.adobe.idml.validation.Validator /MyFiles/PackageIDMLSchema /MyFiles/UnifiedIDMLSchema/MyFiles/Hello.idml

IDML tools comes with several shell script wrappers that show how to set the classpath. See Readme.txt in the IDMLTools directory for more information on these scripts.


Constructor Summary
Validator()
          Simple contructor for instantiated an unoaded Validator.
Validator(java.lang.String schemaPath)
          This constructor takes a path to one schema folder and examines it to decide which type of schema it is, and calls init(String, String) appropriately.
Validator(java.lang.String packageSchemaPath, java.lang.String unifiedSchemaPath)
          Contructor used to create an instance of an Validator loaded with paths to schemas.
 
Method Summary
 java.lang.String getPackateSchema()
           
 java.lang.String getUnifiedSchema()
           
 void init(java.lang.String packageSchemaPath, java.lang.String unifiedSchemaPath)
          Initialize the class with both types of schemas.
static void main(java.lang.String[] args)
           
 void setPackageSchema(java.lang.String packageSchemaPath)
          Set the path to the package schema.
 void setUnifiedSchema(java.lang.String unifiedSchemaPath)
          Sets the unified schema path
 void validate(java.lang.String file)
          This method validates IDML packages (compressed or decompressed) as well as non-package files (ICML and IDMS).
 void validatePackage(java.lang.String idmlFile)
          Valildates an IDML package.
 void validateUnifiedFile(java.lang.String idmlFilePath)
          Validates a non-package file (such as an ICML, IDMS).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Validator

public Validator(java.lang.String packageSchemaPath,
                 java.lang.String unifiedSchemaPath)
Contructor used to create an instance of an Validator loaded with paths to schemas.

Parameters:
packageSchemaPath - A path to the folder containing the package schema. This can be nil if the caller doesn't expect to use a package schema.
unifiedSchemaPath - A path to the folder containing the unified schema. This can be nil if the caller doesn't expect to use a unified schema.

Validator

public Validator(java.lang.String schemaPath)
This constructor takes a path to one schema folder and examines it to decide which type of schema it is, and calls init(String, String) appropriately. If it can find a designmap.rnc file in the schema folder it considers it a package schema. Otherwise, it will be considered a non-package schema.

Parameters:
schemaPath - The path to the schema folder.

Validator

public Validator()
Simple contructor for instantiated an unoaded Validator. This is equivalent to calling Validator(null, null)."

Method Detail

init

public void init(java.lang.String packageSchemaPath,
                 java.lang.String unifiedSchemaPath)
Initialize the class with both types of schemas.

Parameters:
packageSchemaPath - A path to the folder containing the package schema.
unifiedSchemaPath - A path to the folder containing the non-package schema.

setPackageSchema

public void setPackageSchema(java.lang.String packageSchemaPath)
Set the path to the package schema.

Parameters:
packageSchemaPath -

getPackateSchema

public java.lang.String getPackateSchema()
Returns:
the path to the folder containing the package schema

setUnifiedSchema

public void setUnifiedSchema(java.lang.String unifiedSchemaPath)
Sets the unified schema path

Parameters:
unifiedSchemaPath -

getUnifiedSchema

public java.lang.String getUnifiedSchema()
Returns:
the path to the folder containing the unified schema

validatePackage

public void validatePackage(java.lang.String idmlFile)
Valildates an IDML package. This can be either a path to a compressed IDML file, or a directory containing uncompressed IDML files.

Parameters:
idmlFile - A path to a folder or a compressed IDML file.

validateUnifiedFile

public void validateUnifiedFile(java.lang.String idmlFilePath)
Validates a non-package file (such as an ICML, IDMS).

Parameters:
idmlFilePath - The path to the IDML xml file.

validate

public void validate(java.lang.String file)
This method validates IDML packages (compressed or decompressed) as well as non-package files (ICML and IDMS). If the file name has the ".idml" extension (case insensitive) or is a folder, it's considered a package and the package schema is used. Otherwise it's considered to be a single IDML file.

Parameters:
file - The abosolute or relative path to the IDML file of folder.

main

public static void main(java.lang.String[] args)
Parameters:
args -


Copyright © 2008 Adobe Systems Incorporated. All Rights Reserved.