Dsmlv2Parser parser = new Dsmlv2Parser( grammar );
parser.setInput( new FileInputStream( dsmlFile ), "UTF-8" ); //$NON-NLS-1$
parser.parseAllRequests();
// Getting the batch request
BatchRequestDsml batchRequest = parser.getBatchRequest();
// Creating a DSML batch response (only if needed)
BatchResponseDsml batchResponseDsml = null;
if ( responseFile != null )
{
batchResponseDsml = new BatchResponseDsml();
}
// Setting the errors counter
int errorsCount = 0;
// Creating a dummy monitor that will be used to check if something
// went wrong when executing the request
StudioProgressMonitor dummyMonitor = new StudioProgressMonitor( monitor );
// Processing each request
List<DsmlDecorator<? extends Request>> requests = batchRequest.getRequests();
for ( DsmlDecorator<? extends Request> request : requests )
{
// Processing the request
processRequest( request, batchResponseDsml, dummyMonitor );