All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hfg.xml.XMLComment Maven / Gradle / Ivy

There is a newer version: 20240423
Show newest version
package com.hfg.xml;

import com.hfg.exception.ProgrammingException;
import com.hfg.html.Table;

import java.io.OutputStream;
import java.io.IOException;
import java.io.Writer;


public class XMLComment implements XMLizable
{
   private String mComment;

   //##########################################################################
   // CONSTRUCTORS
   //##########################################################################

   //--------------------------------------------------------------------------
   public XMLComment()
   {

   }

   //--------------------------------------------------------------------------
   public XMLComment(String inComment)
   {
      mComment = inComment;
   }

   //##########################################################################
   // PUBLIC METHODS
   //##########################################################################


   //---------------------------------------------------------------------------
   public XMLComment clone()
   {
      XMLComment cloneObj;
      try
      {
         cloneObj = (XMLComment) super.clone();
      }
      catch (CloneNotSupportedException e)
      {
         throw new ProgrammingException(e);
      }

      return cloneObj;
   }

   //---------------------------------------------------------------------------
   public boolean hasContent()
   {
      return true;
   }


   //---------------------------------------------------------------------------
   public void setContent(String inContent)
   {
      mComment = inContent;
   }

   //---------------------------------------------------------------------------
   /**
    Clears content (not subtags).
    */
   public void clearContent()
   {
      mComment = null;
   }

   //---------------------------------------------------------------------------
   public void addContent(String inContent)
   {
      mComment += inContent;
   }

   //---------------------------------------------------------------------------
   /**
    The returned content does not contain any embedded subtags.
    */
   public String getContent()
   {
      return mComment;
   }


   //---------------------------------------------------------------------------
   public String toXML()
   {
      return "";
   }

   //---------------------------------------------------------------------------
   public void toXML(Writer inWriter)
   {
      try
      {
         inWriter.write(toXML());
      }
      catch (IOException e)
      {
         throw new RuntimeException(e);
      }
   }

   //---------------------------------------------------------------------------
   public void toXML(OutputStream inStream)
   {
      try
      {
         inStream.write(toXML().getBytes());
      }
      catch (Exception e)
      {
         throw new XMLException(e);
      }
   }



   //--------------------------------------------------------------------------
   public String toIndentedXML(int inInitialIndentLevel, int inIndentSize)
   {
      return toXML();
   }

   //--------------------------------------------------------------------------
   public void toIndentedXML(OutputStream inOutputStream, int inInitialIndentLevel, int inIndentSize)
   {
      toXML(inOutputStream);
   }

   //--------------------------------------------------------------------------
   public void toIndentedXML(Writer inWriter, int inInitialIndentLevel, int inIndentSize)
   {
      toXML(inWriter);
   }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy