Package nexj.core.util

Examples of nexj.core.util.IndentingXMLWriter


      {
         it.set(new ClassHierarchy((ClassDoc)it.next()));
      }

      FileOutputStream fosStream = null;
      IndentingXMLWriter xmlWriter = null;

      try
      {
         fosStream = new FileOutputStream(new File(m_outputDir, METADATA_FILENAME));
         xmlWriter = new IndentingXMLWriter(new OutputStreamWriter(new BufferedOutputStream(fosStream), XMLUtil.ENCODING));

         m_typeAliasMap = findTypeAliases(scriptingClassDocList);

         startMetadata(xmlWriter);
View Full Code Here


            addMembers(clazz, innerTypeArray[i]);
         }

         // Export to file
         FileOutputStream fosStream = null;
         IndentingXMLWriter xmlWriter = null;

         try
         {
            fosStream = new FileOutputStream(new File(m_outputDir, clazz.getName() + ".meta"));
            xmlWriter = new IndentingXMLWriter(new OutputStreamWriter(new BufferedOutputStream(fosStream), XMLUtil.ENCODING));

            new XMLMetadataExporter(xmlWriter).exportMetaclass(clazz);
         }
         finally
         {
View Full Code Here

   }
  
   public void testNestedIndentWithAttr() throws IOException
   {
      StringWriter buf = new StringWriter();
      IndentingXMLWriter writer = new IndentingXMLWriter(buf, "\t");

      writer.write("Before Start");
      writer.openElement("tag");
         writer.write("Attr");
      writer.closeElement();
         writer.openElement("child1");
            writer.write("Attr1");
         writer.closeElement();
            writer.openElement("child2");
               writer.write("Attr2");
            writer.closeElement();
            writer.endElement("child2");
         writer.endElement("child1");
         writer.startElement("childA");

      assertEquals("Before Start<tagAttr>" +
                   SysUtil.LINE_SEP +
                   "\t<child1Attr1>" +
                   SysUtil.LINE_SEP +
View Full Code Here

   }

   public void testNestedInline() throws IOException
   {
      StringWriter buf = new StringWriter();
      IndentingXMLWriter writer = new IndentingXMLWriter(buf, "\t");

      writer.write("Before Start");
      writer.startElement("tag");
         writer.write("Inline");
      writer.endElement("tag");

      assertEquals("Before Start<tag>Inline</tag>", buf.toString());
   }
View Full Code Here

   }
  
   public void testNestedInlineWithAttr() throws IOException
   {
      StringWriter buf = new StringWriter();
      IndentingXMLWriter writer = new IndentingXMLWriter(buf, "\t");

      writer.write("Before Start");
      writer.openElement("tag");
         writer.write("Attr");
      writer.closeElement();
         writer.write("Inline");
      writer.endElement("tag");

      assertEquals("Before Start<tagAttr>Inline</tag>", buf.toString());
   }
View Full Code Here

   }
  
   public void testNestedEmpty() throws IOException
   {
      StringWriter buf = new StringWriter();
      IndentingXMLWriter writer = new IndentingXMLWriter(buf, "\t");

      writer.write("Before Start");
      writer.startElement("tag");
         writer.openElement("child1");
            writer.write("Attr");
         writer.closeEmptyElement();
         writer.startElement("child2");

      assertEquals("Before Start<tag>" +
                   SysUtil.LINE_SEP +
                   "\t<child1Attr/>" +
                   SysUtil.LINE_SEP +
View Full Code Here

   }
  
   public void testNestedNullIndent() throws IOException
   {
      StringWriter buf = new StringWriter();
      IndentingXMLWriter writer = new IndentingXMLWriter(buf, null);

      writer.write("Before Start");
      writer.startElement("tag");
         writer.startElement("child1");
            writer.startElement("child2");
            writer.endElement("child2");
         writer.endElement("child1");
         writer.startElement("childA");

      assertEquals("Before Start<tag>" +
                   SysUtil.LINE_SEP +
                   "<child1>" +
                   SysUtil.LINE_SEP +
View Full Code Here

   }
  
   public void testNestedEmptyIndent() throws IOException
   {
      StringWriter buf = new StringWriter();
      IndentingXMLWriter writer = new IndentingXMLWriter(buf, "");

      writer.write("Before Start");
      writer.startElement("tag");
         writer.startElement("child1");
            writer.startElement("child2");
            writer.endElement("child2");
         writer.endElement("child1");
         writer.startElement("childA");

      assertEquals("Before Start<tag>" +
                   SysUtil.LINE_SEP +
                   "<child1>" +
                   SysUtil.LINE_SEP +
View Full Code Here

public class IndentingXMLWriterTest extends TestCase
{
   public void testInitialIndent() throws IOException
   {
      StringWriter buf = new StringWriter();
      IndentingXMLWriter out = new IndentingXMLWriter(buf, "\t");

      out.write("Before Start");
      out.startElement("tag");
     
      assertEquals("Before Start<tag>", buf.toString());
   }
View Full Code Here

   }

   public void testNestedIndent() throws IOException
   {
      StringWriter buf = new StringWriter();
      IndentingXMLWriter writer = new IndentingXMLWriter(buf, "\t");

      writer.write("Before Start");
      writer.startElement("tag");
         writer.startElement("child1");
            writer.startElement("child2");
            writer.endElement("child2");
         writer.endElement("child1");
         writer.startElement("childA");

      assertEquals("Before Start<tag>" +
                   SysUtil.LINE_SEP +
                   "\t<child1>" +
                   SysUtil.LINE_SEP +
View Full Code Here

TOP

Related Classes of nexj.core.util.IndentingXMLWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.