Package nexj.core.util

Examples of nexj.core.util.XMLWriter


      StringWriter writer = new StringWriter();
      WSDLGenerator gen = new WSDLGenerator(XMLHTTPServer.SOAP_ACTION_DEFAULT);

      gen.setCompatible(false);
      writer.getBuffer().setLength(0);
      gen.generate(new XMLWriter(writer), null, "baseURI");
      validateDocument(XMLUtil.parse(new StringReader(writer.toString())), "baseURI", null);

      writer.getBuffer().setLength(0);
      gen.generate(new XMLWriter(writer), null, null);
      validateDocument(XMLUtil.parse(new StringReader(writer.toString())), null, null);

      writer.getBuffer().setLength(0);
      gen.generate(new XMLWriter(writer), s_metaList.iterator(), null);
      validateDocument(XMLUtil.parse(new StringReader(writer.toString())), null, s_metaList);
   }
View Full Code Here


      StringWriter writer = new StringWriter();
      WADLGenerator gen = new WADLGenerator();

      gen.setCompatible(false);
      writer.getBuffer().setLength(0);
      gen.generate(new XMLWriter(writer), s_metaList.iterator(), "baseURI");
      validateDocument(XMLUtil.parse(new StringReader(writer.toString())), "baseURI");

      writer.getBuffer().setLength(0);
      gen.generate(new XMLWriter(writer), s_metaList.iterator(), null);
      validateDocument(XMLUtil.parse(new StringReader(writer.toString())), null);
   }
View Full Code Here

   {
      StringWriter writer;

      writer = new StringWriter();
      new XMLMetatype(XML.getTNSType("type"), new XMLMetatype.XMLMetatypeExtension("name", "ns"))
         .writeXSD(new XMLWriter(writer));
      assertEquals("<complexType name=\"type\"><complexContent><extension base=\"ns:name\"></ext" +
                   "ension></complexContent></complexType>",
                   writer.toString());

      writer = new StringWriter();
      new XMLMetatype(XML.getTNSType("type"), new XMLMetatype.XMLMetatypeExtension("nameEmpty", ""))
         .writeXSD(new XMLWriter(writer));
      assertEquals("<complexType name=\"type\"><complexContent><extension base=\"nameEmpty\"></e" +
                   "xtension></complexContent></complexType>",
                   writer.toString());

      writer = new StringWriter();
      new XMLMetatype(
         XML.getTNSType("type"), new XMLMetatype.XMLMetatypeExtension("nameNULL", null))
             .writeXSD(new XMLWriter(writer));
      assertEquals("<complexType name=\"type\"><complexContent><extension base=\"nameNULL\"></ex" +
                   "tension></complexContent></complexType>",
                   writer.toString());
   }
View Full Code Here

   {
      StringWriter writer;

      writer = new StringWriter();
      new XMLMetatype(XML.getTNSType("type"), new XMLMetatype.XMLMetatypeRestriction("name", "ns"))
         .writeXSD(new XMLWriter(writer));
      assertEquals("<complexType name=\"type\"><complexContent><restriction base=\"ns:name\"></r" +
                   "estriction></complexContent></complexType>",
                   writer.toString());

      writer = new StringWriter();
      new XMLMetatype(
         XML.getTNSType("type"), new XMLMetatype.XMLMetatypeRestriction("nameEmpty", ""))
             .writeXSD(new XMLWriter(writer));
      assertEquals("<complexType name=\"type\"><complexContent><restriction base=\"nameEmpty\"><" +
                   "/restriction></complexContent></complexType>",
                   writer.toString());

      writer = new StringWriter();
      new XMLMetatype(
         XML.getTNSType("type"), new XMLMetatype.XMLMetatypeRestriction("nameNULL", null))
             .writeXSD(new XMLWriter(writer));
      assertEquals("<complexType name=\"type\"><complexContent><restriction base=\"nameNULL\"></" +
                   "restriction></complexContent></complexType>",
                   writer.toString());
     
     
View Full Code Here

   public void testAbstract() throws IOException
   {
      StringWriter writer;

      writer = new StringWriter();
      new XMLMetatype(XML.getTNSType("type"), true).writeXSD(new XMLWriter(writer));
      assertEquals("<complexType name=\"type\" abstract=\"true\"></complexType>",
                   writer.toString());

      writer = new StringWriter();
      new XMLMetatype(XML.getTNSType("type"), null).writeXSD(new XMLWriter(writer));
      assertEquals("<complexType name=\"type\"></complexType>", writer.toString());

      writer = new StringWriter();
      new XMLMetatype(XML.getTNSType("type")).writeXSD(new XMLWriter(writer));
      assertEquals("<complexType name=\"type\"></complexType>", writer.toString());
   }
View Full Code Here

      type.addAttribute(new XMLMetatype.XMLMetatypeAttribute("name", "ns"));
      type.addAttribute(new XMLMetatype.XMLMetatypeAttribute("nameNULL", null));
      type.addAttribute(null);
     
      StringWriter writer = new StringWriter();
      type.writeXSD(new XMLWriter(writer));

      assertEquals("<complexType name=\"type\"><attribute ref=\"ns:name\"/><attribute ref=\"name" +
                   "NULL\"/></complexType>",
                   writer.toString());
   }
View Full Code Here

         "name5", new QName("", "type", "typeNS"), 1, -1, false));
      type.addElement(new XMLMetatype.XMLMetatypeElement("name6", new QName("type"), 1, 1, false));
      type.addElement(null);

      StringWriter writer = new StringWriter();
      type.writeXSD(new XMLWriter(writer));

      assertEquals("<complexType name=\"type\"><sequence><element name=\"name1\" type=\"typeNS:t" +
                   "ype\"/><element name=\"name2\" type=\"typeNS:type\" nillable=\"true\"/><elem" +
                   "ent name=\"name3\" type=\"typeNS:type\" minOccurs=\"0\"/><element name=\"nam" +
                   "e4\" type=\"typeNS:type\" maxOccurs=\"2\"/><element name=\"name5\" type=\"ty" +
View Full Code Here

      gen.setCompatible(false);
      gen.setIncludeDocumentation(true);

      writer.getBuffer().setLength(0);
      gen.generate(new XMLWriter(writer), s_metaList.iterator(), "baseURI");
      validateDocument(XMLUtil.parse(new StringReader(writer.toString())), "baseURI", true, false);

      writer.getBuffer().setLength(0);
      gen.generate(new XMLWriter(writer), s_metaList.iterator(), null);
      validateDocument(XMLUtil.parse(new StringReader(writer.toString())), "", true, false);

      gen.setCompatible(true);

      writer.getBuffer().setLength(0);
      gen.generate(new XMLWriter(writer), s_metaList.iterator(), null);
      validateDocument(XMLUtil.parse(new StringReader(writer.toString())), "", false, false);

      gen.setMask(new String[]{"TestMetaTypeMasked"});
      writer.getBuffer().setLength(0);
      gen.generate(new XMLWriter(writer), s_metaList.iterator(), null);
      validateDocument(XMLUtil.parse(new StringReader(writer.toString())), "", false, true);
   }
View Full Code Here

TOP

Related Classes of nexj.core.util.XMLWriter

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.