docs: public Record parseRecord(DocumentBuilder stringdb, Element elParent, String strTagName, String strDatabase, BaseTable table, BaseTable tableMain, boolean bIsMainHasReferenceField)
      {
      	Record record = null;
      	if (table != null)
      		record = table.getRecord();
          if (record == null)
          {
              record = this.getRecord(strTagName);
  	        if (record == null)
  	        {   // Not found, create it!
  	            record = new XmlRecord();
  	            ((XmlRecord)record).setTableName(strTagName);
  	            if (strDatabase != null)
  	                ((XmlRecord)record).setDatabaseName(strDatabase);
  	            ((XmlRecord)record).setDatabaseType(DBConstants.REMOTE);
  	            record.init(this);
  	            Record recMain = null;
  	            if (tableMain != null)
  	            	recMain = tableMain.getRecord();
  	            if (recMain != null)    // If this is a sub-record
  	                if (!bIsMainHasReferenceField)  // And the main record doesn't have a reference to my key
  	            {
  	                ReferenceField fld = new ReferenceField(record, recMain.getTableNames(false) + "ID", DBConstants.DEFAULT_FIELD_LENGTH, null, null);
  	                KeyArea keyArea = record.makeIndex(DBConstants.NOT_UNIQUE, recMain.getTableNames(false) + "ID");
  	                keyArea.addKeyField(fld, DBConstants.ASCENDING);
  	            }
  	            RecordParser parser = new RecordParser(elParent);
  	            while (parser.next(stringdb) != null)
  	            {   // First, add the fields to the record
  	                parser.findField(record, true);     // This will create if not found
  	            }
  	        }
  	        table = record.getTable();
          }
          // Now its time to move the data to the fields and write the record.
          RecordParser parser = new RecordParser(elParent);
          boolean bFirstTime = true;
          while (parser.next(stringdb) != null)
          {
              Node elChild = parser.getChildNode();
              String strName = parser.getName();
              String strValue = parser.getValue();
              boolean bIsRecord = parser.isRecord();
              if (bFirstTime)
              {   // First time thru
                  bFirstTime = false;
                  try   {
                      table.addNew();
      	            Record recMain = null;
      	            if (tableMain != null)
      	            	recMain = tableMain.getRecord();
                      if (recMain != null)
                      {   // If this is a sub-file, be sure to update the reference field.
                          BaseField field = record.getField(recMain.getTableNames(false) + "ID");
                          if (field != null)
                              if (field instanceof ReferenceField)
                                  if (!bIsMainHasReferenceField)
                          {   // If the main record has to get me, but doesn't have my key, save it's key
                              if (recMain.getEditMode() == DBConstants.EDIT_ADD)
                              {   // Main record not added yet, add it now
                                  recMain = this.updateRecord(tableMain, true);   // And return the record written
                                  tableMain.edit();
                              }
                              ((ReferenceField)field).setReference(recMain);  // Reference the main record.
                          }
                      }
                  } catch (DBException ex)    {
                      ex.printStackTrace();
                  }
              }
              BaseField field = parser.findField(record, true);
              if (bIsRecord)
              {   // If this field directly references a record, you have to write the sub-record first.
                  boolean bIsReferenceField = (parser.getReferenceName() != null);
                  Record recNew = this.parseRecord(stringdb, (Element)elChild, strName, strDatabase, null, table, bIsReferenceField);
                  if (bIsReferenceField) if (recNew != null)
                  {
                      ((ReferenceField)field).setReference(recNew);
                      field = null; // Don't set it twice
                  }
              }
              if (field != null)
              {   // Set the data
                  if (field instanceof ObjectField)
                  {
                      try {
  						XmlUtilities.decodeFieldData(field, strValue);
  					} catch (Exception e) {
  						Utility.getLogger().severe("Error - bad base64 input field: " + record.getRecordName());
  						e.printStackTrace();
  					}
                  }
                  else if (field instanceof DateTimeField)
                      XmlUtilities.decodeDateTime((DateTimeField)field, strValue);
                  else
                      field.setString(strValue);
              }
          }
  
          record = this.updateRecord(table, bIsMainHasReferenceField);
          return record;
      }