Package com.sun.org.apache.xml.internal.serialize

Examples of com.sun.org.apache.xml.internal.serialize.XMLSerializer


            Document doc=builder.parse(new ByteArrayInputStream(objectXML));
            OutputFormat fmt=new OutputFormat("XML", "UTF-8", true);
            fmt.setIndent(2);
            fmt.setLineWidth(120);
            fmt.setPreserveSpace(false);
            XMLSerializer ser=new XMLSerializer(outStream, fmt);
            ser.serialize(doc);
        } catch (Exception e) {
            System.out.println("Error on export while serializing object XML." +
                e.getClass().getName() + " : " + e.getMessage());
        } finally {
          outStream.close();
View Full Code Here


                Document doc = builder.parse(zip.getInputStream(entry));

                OutputFormat  format  = new OutputFormat( doc );
                format.setIndenting(true);

                XMLSerializer serial = new  XMLSerializer( out, format );
                serial.asDOMSerializer();
                serial.serialize( doc.getDocumentElement() );

            } else {
                int pos;
                byte[] chunk = new byte[2048];
                InputStream is = zip.getInputStream(entry);
View Full Code Here

  public void saveTo(String path) {
    try {
      OutputFormat format = new OutputFormat(doc);
      format.setIndenting(true);
      XMLSerializer serializer = new XMLSerializer(new FileOutputStream(new File(path)), format);
      serializer.serialize(doc);
    } catch (FileNotFoundException e) {
      e.printStackTrace();
      ErrorUtil.openStackTraceDialog("A Fatal Error has occured and the application will need to shut down", e);
      System.exit(1);
    } catch (IOException e) {
View Full Code Here

                    Node dup = w3cDoc.importNode(node, true);
                    w3cDoc.appendChild(dup);
                    // print document
                    OutputFormat xmlFormat = new OutputFormat("xml","ISO-8859-1", true);
                    xmlFormat.setOmitXMLDeclaration(true);
                    XMLSerializer serializer = new XMLSerializer(stringWriter, xmlFormat);
                    serializer.serialize(w3cDoc);
                   
                    value = stringWriter.toString();
                } catch (ParserConfigurationException e) {
                    e.printStackTrace();
                }   catch (IOException e) {
View Full Code Here

                    Node dup = w3cDoc.importNode(node, true);
                    w3cDoc.appendChild(dup);
                    // print document
                    OutputFormat xmlFormat = new OutputFormat("xml","ISO-8859-1", true);
                    xmlFormat.setOmitXMLDeclaration(true);
                    XMLSerializer serializer = new XMLSerializer(stringWriter, xmlFormat);
                    serializer.serialize(w3cDoc);
                   
                    value = stringWriter.toString();
                } catch (ParserConfigurationException e) {
                    e.printStackTrace();
                }   catch (IOException e) {
View Full Code Here

  }
 
  public void saveXMLDocument() {
      try {
        log.info("saving classpath file...");
      XMLSerializer serializer = new XMLSerializer();
        serializer.setOutputCharStream(new FileWriter(file));
      serializer.serialize(doc);
    } catch (IOException e) {
      log.error("unable to save resulting classpath file!");
      throw new RuntimeException("unable to save resulting classpath file", e);
    }
  }
View Full Code Here

    this.out = out;
    OutputFormat outFormat = new OutputFormat("XML", "UTF-8", true);
    outFormat.setIndenting(true);
    outFormat.setIndent(2);
    outFormat.setDoctype(null, null);
    XMLSerializer serializer = new XMLSerializer(out, outFormat);
    contentHandler = serializer.asContentHandler();
    try {
      contentHandler.startDocument();
      contentHandler.startElement("", "", "EDITS", new AttributesImpl());
    } catch (SAXException e) {
      throw new IOException("SAX error: " + e.getMessage());
View Full Code Here

        try {
            OutputFormat format = new OutputFormat(createDocument());
            format.setLineWidth(65);
            format.setIndenting(true);
            format.setIndent(2);
            XMLSerializer serializer = new XMLSerializer(writer, format);
            serializer.serialize(getDocument());
            writer.close();
        }
        catch (ConfigurationException ce) {
            logger.severe("Failed to save configuration: " + ce.getMessage());
        }
View Full Code Here

        format.setIndenting(true);
        format.setIndent(2);

        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

        XMLSerializer serializer = new XMLSerializer(outputStream, format);
        serializer.serialize(doc);

        return new String(outputStream.toByteArray(), "UTF-8");
    }
View Full Code Here

        format.setIndenting(true);
        format.setIndent(2);

        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

        XMLSerializer serializer = new XMLSerializer(outputStream, format);
        serializer.serialize(doc);

        return new String(outputStream.toByteArray(), "UTF-8");
    }
View Full Code Here

TOP

Related Classes of com.sun.org.apache.xml.internal.serialize.XMLSerializer

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.