Package nu.xom

Examples of nu.xom.Serializer


        //  display the MusicXML file as an unformatted string
          System.out.println(p);
      System.out.print('\n');
*/
        //  write the MusicXML file formatted
        Serializer ser = new Serializer(fosXML, "UTF-8");
        ser.setIndent(4);
        ser.write(MusicXmlOut.getMusicXMLDoc());
       
        fosXML.flush();
      fosXML.close();
         
    } catch (FileNotFoundException e) {
View Full Code Here


        //  display the MusicXML file as an unformatted string
          System.out.println(p);
      System.out.print('\n');
*/
        //  write the MusicXML file formatted
        Serializer ser = new Serializer(fosXML, "UTF-8");
        ser.setIndent(4);
        ser.write(MusicXmlOut.getMusicXMLDoc());
       
        fosXML.flush();
      fosXML.close();
         
    } catch (FileNotFoundException e) {
View Full Code Here

    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

        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

  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

  // 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

    }   
  }
 
  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

        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

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

        root.appendChild(GLOBAL.sketchChairs.getCurChair().toXML());

        Document doc = new Document(root);
        OutputStream outXML = new FileOutputStream(name);
        outXML = new BufferedOutputStream(outXML);
        Serializer serializer = new Serializer(outXML, "ISO-8859-1");
        serializer.write(doc);

        GLOBAL.sketchChairs.getCurChair().localSavelocation = name;

      } catch (FileNotFoundException e) {
        e.printStackTrace();
View Full Code Here

TOP

Related Classes of nu.xom.Serializer

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.