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

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


        data.nsContext = ns;
    }
   
    public void serialize(OutputStream os, Node node, Format format) throws XMLException {
        try {
            XMLSerializer ser = createXMLSerializer(node,format);
            ser.setOutputByteStream(os);
            serialize(ser,node);
        } catch(Exception e) {
            throw new XMLException(e,"Error while converting XML document to string"); // $NLS-AbstractXercesDriver.ErrorwhileconvertingXMLdocumentto-1$
        }
    }
View Full Code Here


        }
    }

    public void serialize(Writer w, Node node, Format format) throws XMLException {
        try {
            XMLSerializer ser = createXMLSerializer(node,format);
            ser.setOutputCharStream(w);
            serialize(ser,node);
        } catch(Exception e) {
            throw new XMLException(e,"Error while converting XML document to string"); // $NLS-AbstractXercesDriver.ErrorwhileconvertingXMLdocumentto.1-1$
        }
    }
View Full Code Here

        }
        OutputFormat format = new OutputFormat(); //node.getOwnerDocument());
        format.setIndent(fmt.indent);
        format.setOmitXMLDeclaration(!fmt.xmlDecl);
        format.setEncoding(fmt.encoding);
        return new XMLSerializer(format);
    }
View Full Code Here

    Document document = xmlValidation.getXMLDocument();
    if (document != null) {
      final StringWriter sWriter = new StringWriter() ;
      final OutputFormat format = new OutputFormat() ;
      format.setIndenting(true) ;
      final XMLSerializer xmlS = new XMLSerializer(sWriter, format) ;
      xmlS.asDOMSerializer() ;
      xmlS.serialize(document) ;
      log.debug(sWriter.toString()) ;
    }
  }
View Full Code Here

        // into streams to send to the external DIG reasoner
        format = new OutputFormat();
        format.setIndent(4);
        format.setIndenting(true);
        format.setPreserveSpace(false);
        serializer = new XMLSerializer(format);
        docBuilderFactory = DocumentBuilderFactory.newInstance();
        docBuilderFactory.setIgnoringElementContentWhitespace(true);

        try {
            docBuilder = docBuilderFactory.newDocumentBuilder();
View Full Code Here

        StringWriter writer = new StringWriter();
        OutputFormat format = new OutputFormat();
        format.setIndent(4);
        format.setIndenting(true);
        XMLSerializer serializer = new XMLSerializer(writer,
                                                     format);
        try {
            serializer.serialize(doc);
            System.out.println(writer.getBuffer().toString());
        }
        catch (IOException e) {
            throw new RuntimeException(e);
        }
View Full Code Here

    public static void serializeXML(Document dom, String pathDest)
    {
    OutputFormat format = new OutputFormat(dom);
    format.setIndenting(true);
   
    XMLSerializer serializer;
    try {
      File fileDest = new File(pathDest);
      serializer = new XMLSerializer(
          new FileOutputStream( fileDest ),
              format);
     
      serializer.serialize(dom);
    } catch (FileNotFoundException e1) {
      JOptionPane.showMessageDialog(null, "Could not create a serielize xml.\n"+e1.getMessage()  );
    } catch (IOException e1) {
      JOptionPane.showMessageDialog(null, "Could not create a serielize xml.\n"+e1.getMessage()  );
    }
View Full Code Here

    public static void writeXml(Document document, OutputStream os) throws TransformerException {
        try {
            OutputFormat format = new OutputFormat(document, PluginConstants.UTF_ENCODING, true);
            format.setIndent(2);
            Writer output = new BufferedWriter(new OutputStreamWriter(os, PluginConstants.UTF_ENCODING));
            XMLSerializer serializer = new XMLSerializer(output, format);
            serializer.serialize(document);
        } catch (IOException e) {
            throw new TransformerException(e);
        }
    }
View Full Code Here

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

        // to generate a file output use fileoutputstream instead of system.out
        FileOutputStream out = new FileOutputStream(new File(file));
        XMLSerializer serializer = new XMLSerializer(out, format);
        serializer.serialize(dom);
    }
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() );
                } catch (Exception e){
                    System.err.println("Failed to parse " + entry.getName() + ", dumping raw content");
                    dump(zip.getInputStream(entry), out);
                }
            } else {
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.