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

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


        DocumentBuilder docBuilder;
        synchronized(FACTORY){
            docBuilder = FACTORY.newDocumentBuilder();
        }
        Document doc = docBuilder.parse(new ByteArrayInputStream(data));
        serializer.serialize(doc);

        ByteArrayInputStream in =
                new ByteArrayInputStream(outStream.toByteArray());
        BufferedReader br =
                new BufferedReader(new InputStreamReader(in, "UTF-8"));
View Full Code Here


        ByteArrayOutputStream out = new ByteArrayOutputStream();
        Writer output = new OutputStreamWriter(out);

        XMLSerializer serializer = new XMLSerializer(output, format);
        try {
            serializer.serialize(node);
        } catch (IOException e) {
            throw new PolicyIndexException("Failed to serialise node " + e.getMessage(), e);
        }
        return out.toByteArray();
    }
View Full Code Here

            DocumentBuilderFactory factory =
                    DocumentBuilderFactory.newInstance();
            factory.setNamespaceAware(true);
            DocumentBuilder builder = factory.newDocumentBuilder();
            Document doc = builder.parse(in);
            ser.serialize(doc);
            return out.toByteArray();
        } catch (Exception e) {
            String message = e.getMessage();
            if (message == null) {
                message = "";
View Full Code Here

                DocumentBuilderFactory factory =
                        DocumentBuilderFactory.newInstance();
                factory.setNamespaceAware(true);
                DocumentBuilder builder = factory.newDocumentBuilder();
                Document doc = builder.parse(new ByteArrayInputStream(bytes));
                ser.serialize(doc);
            }
        } catch (Exception e) {
            System.out.println("ERROR: " + e.getClass().getName() + " : "
                    + e.getMessage());
        } finally {
View Full Code Here

            DocumentBuilderFactory factory =
                    DocumentBuilderFactory.newInstance();
            factory.setNamespaceAware(true);
            DocumentBuilder builder = factory.newDocumentBuilder();
            Document doc = builder.parse(new ByteArrayInputStream(bytes));
            ser.serialize(doc);
        } catch (Exception e) {
            System.out.println("ERROR: " + e.getClass().getName() + " : "
                    + e.getMessage());
        } finally {
            outStream.close();
View Full Code Here

            OutputFormat formatter = new OutputFormat();
            formatter.setEncoding("UTF-8"); // is the default

            XMLSerializer serializer = new XMLSerializer(sout, formatter);
            serializer.serialize(rdfRels);
            rels =
                    RDFRelationshipReader
                            .readRelationships(new ByteArrayInputStream(sout
                                    .toString().getBytes()));
        } catch (Exception e) {
View Full Code Here

                DocumentBuilderFactory factory =
                        DocumentBuilderFactory.newInstance();
                factory.setNamespaceAware(true);
                DocumentBuilder builder = factory.newDocumentBuilder();
                Document doc = builder.parse(data);
                ser.serialize(doc);
                content = new String(buf.toByteArray(), "UTF-8");
            } catch (Exception e) {
                throw new IOException("Error parsing as XML: " + e.getMessage());
            }
        } else {
View Full Code Here

            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

                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

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.