public Macro(File file) throws EOFException, FileNotFoundException, IOException {
  DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
  DocumentBuilder db=null;
  Document doc=null;
  try {
    db=dbf.newDocumentBuilder();
    InputSource is=new InputSource(new UnicodeReader(new FileInputStream(file),FILE_ENCODING));
    is.setEncoding(FILE_ENCODING);
    doc=db.parse(is);
  }
 catch (  Exception e) {
    e.printStackTrace();
    String desc=e.getMessage();
    if (desc == null) {
      desc=e.toString();
    }
    throw new IOException("Error parsing XML: " + desc);
  }
  macroRecords=new ArrayList();
  boolean parsedOK=initializeFromXMLFile(doc.getDocumentElement());
  if (parsedOK == false) {
    name=null;
    macroRecords.clear();
    macroRecords=null;
    throw new IOException("Error parsing XML!");
  }
}

public Macro ( File file ) throws EOFException , FileNotFoundException , IOException { DocumentBuilderFactory dbf = DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder db = null ; Document doc = null ; try { db = dbf . newDocumentBuilder ( ) ; InputSource is = new InputSource ( new UnicodeReader ( new FileInputStream ( file ) , FILE_ENCODING ) ) ; is . setEncoding ( FILE_ENCODING ) ; doc = db . parse ( is ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; String desc = e . getMessage ( ) ; if ( desc == null ) { desc = e . toString ( ) ; } throw new IOException ( "Error parsing XML: " + desc ) ; } macroRecords = new ArrayList ( ) ; boolean parsedOK = initializeFromXMLFile ( doc . getDocumentElement ( ) ) ; if ( parsedOK == false ) { name = null ; macroRecords . clear ( ) ; macroRecords = null ; throw new IOException ( "Error parsing XML!" ) ; } }
loads a macro from a file on disk .
