Examples of Serializer


Examples of nu.xom.Serializer

    System.out.println("checksum=" + bench.checksum);
  }
 
  private static byte[] serializeWithXOM(Document doc, ByteArrayOutputStream out) throws IOException {
//    return doc.toXML().getBytes();
    Serializer ser = new Serializer(out);
//    ser.setIndent(4);
    ser.write(doc);
    return out.toByteArray();
  }
View Full Code Here

Examples of nu.xom.Serializer

        doc.getRootElement().appendChild(children.get(i).copy());
      }
    }
   
    FileOutputStream out = new FileOutputStream(args[2]); // e.g. "romeo100.xml"
    Serializer ser = new Serializer(out);
    ser.write(doc);
    ser.flush();
    out.close();
  }
View Full Code Here

Examples of nu.xom.Serializer

  public static void main(String[] args) throws Exception {
    System.out.println("\nTree structure summary:");
    System.out.println("***********************\n");
    NodeFactory factory = new TreeStructureCollector();
    Document summary = new Builder(factory).build(new File(args[0]));
    Serializer ser = new Serializer(System.out);
    ser.setIndent(4);
    ser.write(summary);
//    System.out.println(XOMUtil.toPrettyXML(summary));

    System.out.println("\nPaths sorted by instance counts:");
    System.out.println("********************************\n");
    String query =
View Full Code Here

Examples of nu.xom.Serializer

  // Saves data as a simple XML file
  public void saveAsXML() throws IOException {
    if (!file.exists()) file.getParentFile().mkdirs();
   
    OutputStream out = new FileOutputStream(file);
    Serializer ser = new Serializer(out);
    ser.setIndent(4);
    ser.write(doc);
    out.close();
  }
View Full Code Here

Examples of nu.xom.Serializer

    }   
  }
 
  private static byte[] serializeWithXOM(Document doc, ByteArrayOutputStream out) throws IOException {
//    return doc.toXML().getBytes();
    Serializer ser = new Serializer(out);
//    ser.setIndent(4);
    ser.write(doc);
    return out.toByteArray();
  }
View Full Code Here

Examples of nu.xom.Serializer

        return responseElement != null ? convertResponse(responseElement) : null;
    }

    private Source convertResponse(Element responseElement) throws IOException {
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        Serializer serializer = createSerializer(os);
        Document document = responseElement.getDocument();
        if (document == null) {
            document = new Document(responseElement);
        }
        serializer.write(document);
        byte[] bytes = os.toByteArray();
        return new StreamSource(new ByteArrayInputStream(bytes));
    }
View Full Code Here

Examples of nu.xom.Serializer

     *
     * @param outputStream the output stream to serialize to
     * @return the serializer
     */
    protected Serializer createSerializer(OutputStream outputStream) {
        return new Serializer(outputStream);
    }
View Full Code Here

Examples of org.ajax4jsf.xml.serializer.Serializer

    if (!haveHead) {
      out.write("<head>");
    }
   
    if (headEvents != null && headEvents.length > 0) {
      Serializer serializer = SerializerFactory.getSerializer(
          OutputPropertiesFactory.getDefaultMethodProperties(Method.XHTML));
     
      serializer.setWriter(out);
     
      ContentHandler contentHandler = serializer.asContentHandler();
      TreeWalker walker = new TreeWalker(contentHandler);

      try {
        contentHandler.startDocument();
       
View Full Code Here

Examples of org.apache.abdera.ext.serializer.Serializer

        if (accessor != null) {
            Object value = eval(accessor, source);
            if (value instanceof Boolean) {
                String val = ((Boolean)value).booleanValue() ? "yes" : "no";
                ObjectContext valueContext = new ObjectContext(val);
                Serializer ser = new SimpleElementSerializer(Constants.DRAFT);
                ser.serialize(val, valueContext, context);
            } else {
                ObjectContext valueContext = new ObjectContext(value);
                context.serialize(value, valueContext);
            }
        }
View Full Code Here

Examples of org.apache.axis.encoding.Serializer

                containingElement.setAttribute("type", getQNameString(qName));
            return;
        }

        // look up the serializer in the TypeMappingRegistry
        Serializer ser = null;
        SerializerFactory factory = null;
        if (tm != null) {
            factory = (SerializerFactory)tm.getSerializer(type);
        } else {
            factory = (SerializerFactory)defaultTM.getSerializer(type);
        }

        // If no factory is found, use the BeanSerializerFactory
        // if applicable, otherwise issue errors and treat as an anyType
        if (factory == null) {
            if (isEnumClass(type)) {
                factory = new EnumSerializerFactory(type, qName);
            } else if (isBeanCompatible(type, true)) {
                factory = new BeanSerializerFactory(type, qName);
            } else {
                return;
            }
        }

        if (factory != null) {
            ser = (Serializer)factory.getSerializerAs(Constants.AXIS_SAX);
        }

        // if we can't get a serializer, that is bad.
        if (ser == null) {
            throw new AxisFault(
                    Messages.getMessage("NoSerializer00", type.getName()));
        }

        Element typeEl;
        try {
            typeEl = ser.writeSchema(type, this);
        } catch (Exception e) {
            throw AxisFault.makeFault(e);
        }

        // If this is an anonymous type, just make the type element a child
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.