protected Element invokeWriteToXML(Element parent, Object o, String name) throws Exception {
      Method         method;
      Class[]        methodClasses;
      Object[]       methodArgs;
      boolean        array;
      Element        node;
      boolean        useDefault;
      
      node       = null;
      method     = null;
      useDefault = false;

      m_CurrentNode = parent;
      
      // default, if null
      if (o == null)
         useDefault = true;
      
      try {
         if (!useDefault) {
            array = o.getClass().isArray();
           
            // display name?
            if (m_CustomMethods.write().contains(name))
               method = (Method) m_CustomMethods.write().get(o.getClass());
            else
            // class?
            if ( (!array) && (m_CustomMethods.write().contains(o.getClass())) )
               method = (Method) m_CustomMethods.write().get(o.getClass());
            else
               method = null;
            
            useDefault = (method == null);
         }

         // custom
         if (!useDefault) {
             methodClasses    = new Class[3];
             methodClasses[0] = Element.class;
             methodClasses[1] = Object.class;
             methodClasses[2] = String.class;
             methodArgs       = new Object[3];
             methodArgs[0]    = parent;
             methodArgs[1]    = o;
             methodArgs[2]    = name;
             node = (Element) method.invoke(this, methodArgs);
         }
         // standard
         else {
            node = writeToXML(parent, o, name);
         }
      }
      catch (Exception e) {
         if (DEBUG)
            e.printStackTrace();
         
         if (m_CurrentNode != null) {
           System.out.println("Happened near: " + getPath(m_CurrentNode));
           // print it only once!
           m_CurrentNode = null;
         }
         System.out.println("PROBLEM (write): " + name);

         throw (Exception) e.fillInStackTrace();
      }
      
      return node;
   }