cleanup / abuse system fix / prepping for a release
[mir.git] / source / mir / producer / reader / ProducerConfigReader.java
index 2de7d06..3b10689 100755 (executable)
 package  mir.producer.reader;
 
 import java.io.File;
+import java.io.Reader;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.Vector;
 
 import mir.producer.CompositeProducerNode;
 import mir.producer.ProducerFactory;
 import mir.producer.ProducerNode;
 import mir.producer.SimpleProducerVerb;
-import mir.util.XMLReader;
-import mir.util.XMLReaderTool;
+import mir.util.ExceptionRoutines;
+import mir.util.xml.XMLParserEngine;
+import mir.util.xml.XMLParserExc;
+import mir.util.xml.XMLParserFailure;
 
 public class ProducerConfigReader {
   private ProducerNodeBuilderLibrary builderLibrary;
@@ -51,56 +54,66 @@ public class ProducerConfigReader {
 
   public ProducerConfigReader() {
     super();
-  };
-
-  public void parseFile(String aFileName, ProducerNodeBuilderLibrary aBuilderLibrary, List aProducerFactories) throws ProducerConfigFailure {
-    parseFile(aFileName, aBuilderLibrary, aProducerFactories, new Vector());
   }
 
-  public void parseFile(String aFileName, ProducerNodeBuilderLibrary aBuilderLibrary, List aProducerFactories, List aUsedFiles) throws ProducerConfigFailure {
+  public void parse(Reader aReader, ProducerNodeBuilderLibrary aBuilderLibrary, List aProducerFactories) throws ProducerConfigFailure {
     try {
-      XMLReader reader = new XMLReader();
-      aUsedFiles.add(new File(aFileName));
-
       builderLibrary = aBuilderLibrary;
       scriptedNodeBuilderLibrary = new ProducerNodeBuilderLibrary();
 
-      reader.parseFile(aFileName, new RootSectionHandler(aProducerFactories));
+      XMLParserEngine.getInstance().parse("", aReader, new RootSectionHandler(aProducerFactories));
 
     }
     catch (Throwable e) {
-      if ((e instanceof XMLReader.XMLReaderExc) && ((XMLReader.XMLReaderExc) e).getHasLocation()) {
-        XMLReader.XMLReaderExc f = (XMLReader.XMLReaderExc) e;
-        throw new ProducerConfigFailure("'" + f.getMessage()+"' in " + f.getFilename()+"(line " + f.getLineNr()+", column " + f.getColumnNr() + ")", e);
+      Throwable root = ExceptionRoutines.traceCauseException(e);
+
+      if ((root instanceof XMLParserExc) && ((XMLParserExc) root).getHasLocation()) {
+        XMLParserExc f = (XMLParserExc) root;
+        throw new ProducerConfigFailure(f.getMessage()+" on line " + f.getLineNr()+", column " + f.getColumnNr(), e);
       }
-      throw new ProducerConfigFailure( e );
+      throw new ProducerConfigFailure(root);
     }
   }
+  public void parse(File aFile, ProducerNodeBuilderLibrary aBuilderLibrary, List aProducerFactories) throws ProducerConfigFailure {
+    try {
+      builderLibrary = aBuilderLibrary;
+      scriptedNodeBuilderLibrary = new ProducerNodeBuilderLibrary();
+
+      XMLParserEngine.getInstance().parse("", aFile, new RootSectionHandler(aProducerFactories));
+
+    }
+    catch (Throwable e) {
+      Throwable root = ExceptionRoutines.traceCauseException(e);
 
+      if ((root instanceof XMLParserExc) && ((XMLParserExc) root).getHasLocation()) {
+        XMLParserExc f = (XMLParserExc) root;
+        throw new ProducerConfigFailure(f.getMessage()+" on line " + f.getLineNr()+", column " + f.getColumnNr(), e);
+      }
+      throw new ProducerConfigFailure(root);
+    }
+  }
 
-  public class RootSectionHandler extends XMLReader.AbstractSectionHandler {
+  public class RootSectionHandler extends mir.util.xml.AbstractSectionHandler {
     private List producers;
 
     public RootSectionHandler(List aProducers) {
       producers = aProducers;
     }
 
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+    public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
       if (aTag.equals("producers")) {
         return new ProducersSectionHandler(producers);
       }
-      else
-        throw new XMLReader.XMLReaderExc("Tag 'producers' expected, tag '"+aTag+"' found");
+                       throw new XMLParserExc("Tag 'producers' expected, tag '"+aTag+"' found");
     }
 
-    public void endElement(XMLReader.SectionHandler aHandler) {
+    public void endElement(mir.util.xml.SectionHandler aHandler) {
     }
 
     public void finishSection() {
     }
   }
 
-
   private final static String   PRODUCER_NAME_ATTRIBUTE = "name";
   private final static String[] PRODUCER_REQUIRED_ATTRIBUTES = { PRODUCER_NAME_ATTRIBUTE };
   private final static String[] PRODUCER_OPTIONAL_ATTRIBUTES = { };
@@ -109,7 +122,7 @@ public class ProducerConfigReader {
   private final static String[] NODE_DEFINITION_REQUIRED_ATTRIBUTES = { NODE_DEFINITION_NAME_ATTRIBUTE };
   private final static String[] NODE_DEFINITION_OPTIONAL_ATTRIBUTES = {  };
 
-  public class ProducersSectionHandler extends XMLReader.AbstractSectionHandler {
+  public class ProducersSectionHandler extends mir.util.xml.AbstractSectionHandler {
     private List producers;
     private Set producerNames;
     private String name;
@@ -119,17 +132,17 @@ public class ProducerConfigReader {
       producerNames = new HashSet();
     }
 
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+    public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
       if (aTag.equals("producer")) {
-        XMLReaderTool.checkAttributes(anAttributes,
+        mir.util.xml.XMLReaderTool.checkAttributes(anAttributes,
                                       PRODUCER_REQUIRED_ATTRIBUTES,
                                       PRODUCER_OPTIONAL_ATTRIBUTES);
 
         name = (String) anAttributes.get(PRODUCER_NAME_ATTRIBUTE);
-        XMLReaderTool.checkValidIdentifier(name);
+        mir.util.xml.XMLReaderTool.checkValidIdentifier(name);
 
         if (producerNames.contains(name))
-          throw new XMLReader.XMLReaderExc("Duplicate producer name: '" +
+          throw new XMLParserExc("Duplicate producer name: '" +
                                            name + "'");
 
         name = (String) anAttributes.get(PRODUCER_NAME_ATTRIBUTE);
@@ -137,21 +150,21 @@ public class ProducerConfigReader {
         return new ProducerSectionHandler(name);
       }
       else if (aTag.equals("nodedefinition")) {
-        XMLReaderTool.checkAttributes(anAttributes,
+        mir.util.xml.XMLReaderTool.checkAttributes(anAttributes,
                                       NODE_DEFINITION_REQUIRED_ATTRIBUTES,
                                       NODE_DEFINITION_OPTIONAL_ATTRIBUTES);
 
         name = (String) anAttributes.get(NODE_DEFINITION_NAME_ATTRIBUTE);
-        XMLReaderTool.checkValidIdentifier(name);
+        mir.util.xml.XMLReaderTool.checkValidIdentifier(name);
 
         name = (String) anAttributes.get(NODE_DEFINITION_NAME_ATTRIBUTE);
 
         return new NodeDefinitionSectionHandler(name);
       }
-      throw new XMLReader.XMLReaderExc("Unexpected tag: " + aTag);
+      throw new XMLParserExc("Unexpected tag: " + aTag);
     }
 
-    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+    public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
       if (aHandler instanceof ProducerSectionHandler) {
         producers.add(((ProducerSectionHandler) aHandler).getProducerFactory());
         producerNames.add(((ProducerSectionHandler) aHandler).getProducerFactory().getName());
@@ -161,14 +174,14 @@ public class ProducerConfigReader {
             new DefaultProducerNodeBuilders.ScriptedProducerNodeBuilder.factory(
                 ((NodeDefinitionSectionHandler) aHandler).getDefinition()));
       }
-      else throw new XMLReader.XMLReaderExc("ProducersSectionHandler.endElement Internal error: Unexpected handler: " + aHandler.getClass().getName());
+      else throw new XMLParserExc("ProducersSectionHandler.endElement Internal error: Unexpected handler: " + aHandler.getClass().getName());
     }
 
     public void finishSection() {
     }
   }
 
-  public class ProducerSectionHandler extends XMLReader.AbstractSectionHandler {
+  public class ProducerSectionHandler extends mir.util.xml.AbstractSectionHandler {
     private ProducerFactory producerFactory;
     private String factoryName;
 
@@ -181,25 +194,23 @@ public class ProducerConfigReader {
       factoryName = aName;
     }
 
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+    public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
       if (aTag.equals("verbs")) {
         if (verbs!=null)
-          throw new XMLReader.XMLReaderExc("Verbs already processed");
+          throw new XMLParserExc("Verbs already processed");
         if (body!=null)
-          throw new XMLReader.XMLReaderExc("Verbs should come before body");
-        else
-          return new ProducerVerbsSectionHandler();
+          throw new XMLParserExc("Verbs should come before body");
+                               return new ProducerVerbsSectionHandler();
       }
       else if (aTag.equals("body")) {
         if (body==null)
           return new ProducerNodeSectionHandler();
-        else
-          throw new XMLReader.XMLReaderExc("Body already processed");
+                               throw new XMLParserExc("Body already processed");
       }
-      throw new XMLReader.XMLReaderExc("Unexpected tag: '"+aTag+"'");
+      throw new XMLParserExc("Unexpected tag: '"+aTag+"'");
     }
 
-    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+    public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
       if (aHandler instanceof ProducerNodeSectionHandler) {
         body = ((ProducerNodeSectionHandler) aHandler).getProducerNode();
       }
@@ -209,15 +220,15 @@ public class ProducerConfigReader {
         verbNodes = ((ProducerVerbsSectionHandler) aHandler).getVerbNodes();
         defaultVerb = ((ProducerVerbsSectionHandler) aHandler).getDefaultVerb();
       }
-      else throw new XMLReader.XMLReaderExc("ProducerSectionHandler.endElement Internal error: Unexpected handler: " + aHandler.getClass().getName());
+      else throw new XMLParserExc("ProducerSectionHandler.endElement Internal error: Unexpected handler: " + aHandler.getClass().getName());
     }
 
-    public void finishSection() throws XMLReader.XMLReaderExc {
+    public void finishSection() throws XMLParserExc {
       if (verbs==null)
-        throw new XMLReader.XMLReaderExc("No verbs defined");
+        throw new XMLParserExc("No verbs defined");
 
       if (body==null)
-        throw new XMLReader.XMLReaderExc("No body defined");
+        throw new XMLParserExc("No body defined");
 
       producerFactory = new ScriptedProducerFactory(factoryName, verbs, verbNodes, body, defaultVerb);
     }
@@ -233,7 +244,7 @@ public class ProducerConfigReader {
   private final static String[] PRODUCER_VERB_REQUIRED_ATTRIBUTES = { PRODUCER_VERB_NAME_ATTRIBUTE };
   private final static String[] PRODUCER_VERB_OPTIONAL_ATTRIBUTES = { PRODUCER_VERB_DEFAULT_ATTRIBUTE, PRODUCER_VERB_DESCRIPTION_ATTRIBUTE };
 
-  public class ProducerVerbsSectionHandler extends XMLReader.AbstractSectionHandler {
+  public class ProducerVerbsSectionHandler extends mir.util.xml.AbstractSectionHandler {
     private Map verbNodes;
     private List verbs;
     private String defaultVerb;
@@ -242,26 +253,26 @@ public class ProducerConfigReader {
 
     public ProducerVerbsSectionHandler() {
       verbNodes = new HashMap();
-      verbs = new Vector();
+      verbs = new ArrayList();
       defaultVerb = null;
     }
 
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+    public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
       if (aTag.equals("verb")) {
-        XMLReaderTool.checkAttributes(anAttributes,
+        mir.util.xml.XMLReaderTool.checkAttributes(anAttributes,
                                       PRODUCER_VERB_REQUIRED_ATTRIBUTES,
                                       PRODUCER_VERB_OPTIONAL_ATTRIBUTES);
         currentVerb = (String) anAttributes.get(PRODUCER_VERB_NAME_ATTRIBUTE);
 
-        XMLReaderTool.checkValidIdentifier(currentVerb);
+        mir.util.xml.XMLReaderTool.checkValidIdentifier(currentVerb);
 
         if (verbNodes.containsKey(currentVerb))
-          throw new XMLReader.XMLReaderExc("Duplicate definition of verb '" +
+          throw new XMLParserExc("Duplicate definition of verb '" +
                                            currentVerb + "'");
 
         if (anAttributes.containsKey(PRODUCER_VERB_DEFAULT_ATTRIBUTE)) {
           if (defaultVerb != null)
-            throw new XMLReader.XMLReaderExc("Default verb already declared");
+            throw new XMLParserExc("Default verb already declared");
 
           defaultVerb = currentVerb;
         }
@@ -274,11 +285,10 @@ public class ProducerConfigReader {
 
         return new ProducerNodeSectionHandler();
       }
-      else
-        throw new XMLReader.XMLReaderExc("Only 'verb' tags allowed here, '" + aTag + "' encountered.");
+                       throw new XMLParserExc("Only 'verb' tags allowed here, '" + aTag + "' encountered.");
     }
 
-    public void endElement(XMLReader.SectionHandler aHandler) {
+    public void endElement(mir.util.xml.SectionHandler aHandler) {
       verbNodes.put(currentVerb, ((ProducerNodeSectionHandler) aHandler).getProducerNode());
       verbs.add(new SimpleProducerVerb(currentVerb, currentVerbDescription));
     }
@@ -299,19 +309,19 @@ public class ProducerConfigReader {
     }
   }
 
-  public class EmptySectionHandler extends XMLReader.AbstractSectionHandler {
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
-      throw new XMLReader.XMLReaderExc("No tags are allowed here");
+  public class EmptySectionHandler extends mir.util.xml.AbstractSectionHandler {
+    public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
+      throw new XMLParserExc("No tags are allowed here");
     }
 
-    public void endElement(XMLReader.SectionHandler aHandler) {
+    public void endElement(mir.util.xml.SectionHandler aHandler) {
     }
 
     public void finishSection() {
     }
   }
 
-  public class MultiProducerNodeSectionHandler extends XMLReader.AbstractSectionHandler {
+  public class MultiProducerNodeSectionHandler extends mir.util.xml.AbstractSectionHandler {
     private Map nodeParameters;
     private Set validNodeParameters;
     private String currentNodeParameter;
@@ -328,25 +338,25 @@ public class ProducerConfigReader {
       this("", new HashSet(), aValidNodeParameters);
     }
 
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+    public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
       if (!validNodeParameters.contains(aTag))
-        throw new XMLReader.XMLReaderExc("Invalid node parameter: '" + aTag + "'");
+        throw new XMLParserExc("Invalid node parameter: '" + aTag + "'");
       else if (nodeParameters.containsKey(aTag))
-        throw new XMLReader.XMLReaderExc("Node parameter: '" + aTag + "' already specified");
+        throw new XMLParserExc("Node parameter: '" + aTag + "' already specified");
       else if (anAttributes.size()>0)
-        throw new XMLReader.XMLReaderExc("No parameters are allowed here");
+        throw new XMLParserExc("No parameters are allowed here");
 
       currentNodeParameter = aTag;
 
       return new ProducerNodeSectionHandler(scriptedNodeName, allowedNodeParameterReferences);
     }
 
-    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc  {
+    public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc  {
       if (aHandler instanceof ProducerNodeSectionHandler) {
         nodeParameters.put(currentNodeParameter, ((ProducerNodeSectionHandler) aHandler).getProducerNode());
       }
       else {
-        throw new XMLReader.XMLReaderExc("Internal error: unknown section handler '" + aHandler.getClass().getName() + "'" );
+        throw new XMLParserExc("Internal error: unknown section handler '" + aHandler.getClass().getName() + "'" );
       }
     }
 
@@ -358,7 +368,7 @@ public class ProducerConfigReader {
     }
   }
 
-  public class ProducerNodeSectionHandler extends XMLReader.AbstractSectionHandler {
+  public class ProducerNodeSectionHandler extends mir.util.xml.AbstractSectionHandler {
     private CompositeProducerNode producerNode;
     private ProducerNodeBuilder currentBuilder;
     private String scriptedNodeName;
@@ -374,11 +384,11 @@ public class ProducerConfigReader {
       this("", new HashSet());
     }
 
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+    public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
       try {
         if (allowedNodeParameterReferences.contains( (aTag))) {
           if (!anAttributes.isEmpty()) {
-            throw new XMLReader.XMLReaderExc("No attributes allowed");
+            throw new XMLParserExc("No attributes allowed");
           }
 
           currentBuilder = new DefaultProducerNodeBuilders.
@@ -409,15 +419,14 @@ public class ProducerConfigReader {
           }
         }
         else
-          throw new XMLReader.XMLReaderExc("Unknown producer node tag: '" +
-                                           aTag + "'");
+          throw new XMLParserExc("Unknown producer node tag: '" + aTag + "'");
       }
       catch (Throwable t) {
-        throw new XMLReader.XMLReaderFailure(t);
+        throw new XMLParserFailure(t);
       }
     }
 
-    public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc  {
+    public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc  {
       try {
         if (aHandler instanceof ProducerNodeSectionHandler) {
           currentBuilder.setSubNode(
@@ -442,7 +451,7 @@ public class ProducerConfigReader {
           // deliberately empty: nothing expected, so nothing to process
         }
         else {
-          throw new XMLReader.XMLReaderExc(
+          throw new XMLParserExc(
               "Internal error: unknown section handler '" +
               aHandler.getClass().getName() + "'");
         }
@@ -451,7 +460,7 @@ public class ProducerConfigReader {
         currentBuilder = null;
       }
       catch (Throwable t) {
-        throw new XMLReader.XMLReaderFailure(t);
+        throw new XMLParserFailure(t);
       }
     }
 
@@ -459,16 +468,14 @@ public class ProducerConfigReader {
       if (producerNode.getNrSubNodes()==1) {
         return producerNode.getSubNode(0);
       }
-      else {
-        return producerNode;
-      }
+                       return producerNode;
     }
 
     public void finishSection() {
     }
   }
 
-  public class NodeDefinitionSectionHandler extends XMLReader.AbstractSectionHandler {
+  public class NodeDefinitionSectionHandler extends mir.util.xml.AbstractSectionHandler {
     private ScriptedProducerNodeDefinition nodeDefinition;
     private ProducerNode body;
     private Map stringParameters;
@@ -484,30 +491,30 @@ public class ProducerConfigReader {
       name = aName;
     }
 
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+    public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
       if (aTag.equals("parameters")) {
         if (!anAttributes.isEmpty()) {
-          throw new XMLReader.XMLReaderExc( "No attributes allowed for tag 'parameters'" );
+          throw new XMLParserExc( "No attributes allowed for tag 'parameters'" );
         }
         if (nodeParameters!=null) {
-          throw new XMLReader.XMLReaderExc( "Parameters have already been declared" );
+          throw new XMLParserExc( "Parameters have already been declared" );
         }
         if (body!=null) {
-          throw new XMLReader.XMLReaderExc( "Parameters should come before definition in nodedefinition '" + name +"'" );
+          throw new XMLParserExc( "Parameters should come before definition in nodedefinition '" + name +"'" );
         }
 
         return new NodeDefinitionParametersSectionHandler();
       }
       else if (aTag.equals("definition")) {
         if (nodeParameters==null)
-          throw new XMLReader.XMLReaderExc( "Parameters should come before definition in nodedefinition '" + name +"'"  );
+          throw new XMLParserExc( "Parameters should come before definition in nodedefinition '" + name +"'"  );
 
         return new ProducerNodeSectionHandler(name, nodeParameters.keySet());
       }
-      else throw new XMLReader.XMLReaderExc("Only 'definition' or 'parameters' tags allowed here, '" + aTag + "' encountered.");
+      else throw new XMLParserExc("Only 'definition' or 'parameters' tags allowed here, '" + aTag + "' encountered.");
     }
 
-    public void endElement(XMLReader.SectionHandler aHandler) {
+    public void endElement(mir.util.xml.SectionHandler aHandler) {
       if (aHandler instanceof NodeDefinitionParametersSectionHandler) {
         stringParameters = ((NodeDefinitionParametersSectionHandler) aHandler).getStringParameters();
         integerParameters = ((NodeDefinitionParametersSectionHandler) aHandler).getIntegerParameters();
@@ -518,10 +525,10 @@ public class ProducerConfigReader {
       }
     }
 
-    public void finishSection() throws XMLReader.XMLReaderExc {
+    public void finishSection() throws XMLParserExc {
       Iterator i;
       if (body == null)
-        throw new XMLReader.XMLReaderExc( "Definition missing" );
+        throw new XMLParserExc( "Definition missing" );
 
       nodeDefinition = new ScriptedProducerNodeDefinition(name);
 
@@ -556,7 +563,7 @@ public class ProducerConfigReader {
   private final static String[] NODE_DEFINITION_PARAMETER_OPTIONAL_ATTRIBUTES = { NODE_DEFINITION_PARAMETER_DEFAULTVALUE_ATTRIBUTE };
   private final static String[] NODE_DEFINITION_NODE_PARAMETER_OPTIONAL_ATTRIBUTES = { };
 
-  public class NodeDefinitionParametersSectionHandler extends XMLReader.AbstractSectionHandler {
+  public class NodeDefinitionParametersSectionHandler extends mir.util.xml.AbstractSectionHandler {
     private Map nodeParameters;
     private Map stringParameters;
     private Map integerParameters;
@@ -567,29 +574,29 @@ public class ProducerConfigReader {
       integerParameters = new HashMap();
     }
 
-    public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+    public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
       String parameterName;
       String defaultValue;
 
       if (aTag.equals("node")) {
-        XMLReaderTool.checkAttributes(anAttributes,
+        mir.util.xml.XMLReaderTool.checkAttributes(anAttributes,
             NODE_DEFINITION_PARAMETER_REQUIRED_ATTRIBUTES,
             NODE_DEFINITION_NODE_PARAMETER_OPTIONAL_ATTRIBUTES);
         parameterName = (String) anAttributes.get(
             NODE_DEFINITION_PARAMETER_NAME_ATTRIBUTE);
 
         if (nodeParameters.containsKey(parameterName))
-          throw new XMLReader.XMLReaderExc("Duplicate parameter name: '" +
+          throw new XMLParserExc("Duplicate parameter name: '" +
                                            parameterName + "'");
 
-        XMLReaderTool.checkValidIdentifier(parameterName);
+        mir.util.xml.XMLReaderTool.checkValidIdentifier(parameterName);
 
         nodeParameters.put(parameterName, parameterName);
 
         return new EmptySectionHandler();
       }
       else if (aTag.equals("string") || aTag.equals("integer")) {
-        XMLReaderTool.checkAttributes(anAttributes,
+        mir.util.xml.XMLReaderTool.checkAttributes(anAttributes,
             NODE_DEFINITION_PARAMETER_REQUIRED_ATTRIBUTES,
             NODE_DEFINITION_PARAMETER_OPTIONAL_ATTRIBUTES);
         parameterName = (String) anAttributes.get(
@@ -597,10 +604,10 @@ public class ProducerConfigReader {
 
         if (stringParameters.containsKey(parameterName) ||
             integerParameters.containsKey(parameterName))
-          throw new XMLReader.XMLReaderExc("Duplicate parameter name: '" +
+          throw new XMLParserExc("Duplicate parameter name: '" +
                                            parameterName + "'");
 
-        XMLReaderTool.checkValidIdentifier(parameterName);
+        mir.util.xml.XMLReaderTool.checkValidIdentifier(parameterName);
 
         defaultValue = (String) anAttributes.get(
             NODE_DEFINITION_PARAMETER_DEFAULTVALUE_ATTRIBUTE);
@@ -613,11 +620,11 @@ public class ProducerConfigReader {
         return new EmptySectionHandler();
       }
       else
-        throw new XMLReader.XMLReaderExc(
+        throw new XMLParserExc(
             "Only 'string', 'integer' and 'node' tags allowed here, '" + aTag + "' encountered.");
     }
 
-    public void endElement(XMLReader.SectionHandler aHandler) {
+    public void endElement(mir.util.xml.SectionHandler aHandler) {
     }
 
     public void finishSection() {