Configuring an XML data driver by using a configuration file
You can configure an XML data driver by using a configuration file.
About this task
To configure an XML data driver, you can write some code that uses a configuration file when a driver instance is created.
Procedure
To configure an XML data driver by using a configuration file:
Use code such as the following, which demonstrates how
to read a configuration file and use it when a driver instance is
created.
import ilog.rules.util.resources.IlrResources;
IlrReflect reflect = ... // coming from somewhere
IlrResources res = reflect.getResources();
res.putString( "ilog.rules.xml.errorHandlerClass", "MyXmlErrorHandler" );
try {
IlrXmlDataDriver driver = IlrXmlHelper.createDataDriver ( reflect );
} catch ( IlrXmlErrorException e) {}
// process creation error
}
}
else {
// process error
}
The following example shows the resource file:
node ilog.rules.xml
{
element errorHandlerClass = "MyXmlErrorHandler";
}
Note:
Use the Java™ API to set the XML parser property, do not set it directly in the file.