title: write html using StAX API
body: <p>I am new to Java, I am using StAX api to write html, (I know it is for xml)  but in the method writer.writeCharacters() if I added the unicode string<br>
  &amp; #x25ca;, the html content contains &amp; amp;#x25ca; (Space is not there between &amp; and amp).
  How to add special characters which html supports. I mean I no escaping should happen.</p>
  
  <p>Using just a FileWriter is enough to write large html files or is there any specific API's are there. I searched the web, I found many solutions but if lot of String content is involved how efficiently can I write using FileWriter without consuming more memory.</p>
  
  <pre><code> public class BuildHtml
     {
      static final Logger logger = Logger.getLogger(BuildHtml.class);
      public static void main(String[] args) 
         {        
      final String inFilePath = System.getProperty("user.dir") + "/test_output/output.html";
      XMLOutputFactory factory = XMLOutputFactory.newInstance();
      FileOutputStream fout = null;
      XMLStreamWriter writer = null;
      try 
      {
          fout = new FileOutputStream(inFilePath);
          writer = factory.createXMLStreamWriter(fout);
          writer.writeStartElement("html");
          writer.writeStartElement("head");
          writer.writeStartElement("body");
          writer.writeStartElement("table");
          writer.writeAttribute("align", "center");
          writer.writeAttribute("border", "1");
          writer.writeStartElement("tbody");
  
          for (int i = 0; i &lt; 10000; i++) 
          {
              writer.writeStartElement("tr");
              for (int j = 0; j &lt; 10000; j++) 
              {
                  writer.writeStartElement("td");
                  writer.writeCharacters(("" + j));
                  writer.writeCharacters("&amp;#x25ca;")
                  writer.writeEndElement();
              }
              writer.writeEndElement();
          }
          writer.writeEndDocument();
          System.out.println("XML created.");
      } catch (Exception e) {
          logger.info("exception", e);
      }
      finally {
          try {
              if(writer != null)
              {
                  writer.flush();
                  writer.close();
              }
              if(fout != null)
              {
                  fout.flush();
                  fout.close();
              }
          } catch (IOException | XMLStreamException e) {
              e.printStackTrace();
          }           
      }
  }
  }
  </code></pre>