/********************************************************************
 *  Oracle JDeveloper
 *  Copyright (c) 1997, 1999, Oracle Corporation. All rights reserved.
 ********************************************************************/


package oracle.jdeveloper.html;

import java.io.PrintWriter;
import java.io.OutputStream;

/**
 * A class representing the base root class used by all HTML
 * generation classes. Is is never instantiated, it simply
 * provides some common services shared by all derived
 * classes.
 *
 * @author  Juan Oropeza
 * @version PUBLIC
 *
 */

public abstract class DHTMLElement extends HTMLElement
{
   static public void CheckValidName(String name)
   {
      boolean invalidName = true;
   
      if (name != null)
      {
         name.trim();
         if (name.indexOf(' ') < 0)
         {
            invalidName = false;
         }
      }
   
      if (invalidName)
      {
         String error = Res.format(Res.DHTML_INVALID_NAME_ERROR, name);
         throw new RuntimeException(error);
      }
   }

   static public String filterDataChar(String sValue)
   {
      int idx;

      while ((idx = sValue.indexOf('\n')) >= 0)
      {
         sValue = sValue.substring(0, idx) + "\\n" + sValue.substring(idx + 1);
      }
      
      return sValue;
   }
}


