{
// Prepare the DOM source
Source source = new DOMSource( ruleExecutionSetElement );
// Create a reader to handle the SAX events
RuleSetReader reader;
try
{
reader =
new RuleSetReader( DefaultSemanticsRepository.getInstance( ) );
}
catch ( SemanticsReaderException e )
{
throw new RuleExecutionSetCreateException(
"Couldn't get an instance of the DefaultSemanticsRepository: "
+ e );
}
catch ( IOException e )
{
throw new RuleExecutionSetCreateException(
"Couldn't get an instance of the DefaultSemanticsRepository: "
+ e );
}
try
{
// Prepare the result
SAXResult result = new SAXResult( reader );
// Create a transformer
Transformer xformer =
TransformerFactory.newInstance( ).newTransformer( );
// Traverse the DOM tree
xformer.transform( source, result );
}
catch ( TransformerException e )
{
throw new RuleExecutionSetCreateException(
"could not create RuleExecutionSet: " + e );
}
RuleSet ruleSet = reader.getRuleSet( );
LocalRuleExecutionSetProviderImpl localRuleExecutionSetProvider =
new LocalRuleExecutionSetProviderImpl( );
return localRuleExecutionSetProvider.createRuleExecutionSet(
ruleSet, properties );
}