Package org.apache.xml.serialize

Examples of org.apache.xml.serialize.XMLSerializer


            options.getMaxAcceptableCost());
        report = new SourceReportGenerator(gradeCategories, sourceLoader,
            new File("te-report"), costModel, new Date(), options.getWorstOffenderCount(), cfg);
        break;
      case xml:
        XMLSerializer xmlSerializer = new XMLSerializer();
        xmlSerializer.setOutputByteStream(out);
        OutputFormat format = new OutputFormat();
        format.setIndenting(true);
        xmlSerializer.setOutputFormat(format);
        report = new XMLReportGenerator(xmlSerializer, costModel, options);
        break;
      case about:
        reportModel.setMessageBundle(bundleModel);
        reportModel.setSourceLinker(new SourceLinkerModel(linker));
View Full Code Here


        try
        {
            generateXML();
            log(xmlSchema);
            xmlSerializer = new XMLSerializer(
                    new PrintWriter(
                    new FileOutputStream(xmlSchema)),
                    new OutputFormat(Method.XML, null, true));
            xmlSerializer.serialize(doc);
        }
View Full Code Here

        }
    }

    private void writeDocument(Document document, OutputStream out) throws IOException
    {
        XMLSerializer serializer = new XMLSerializer(out, new OutputFormat(document, null, true));
        serializer.serialize(document);
    }
View Full Code Here

            private static ContentHandler initXmlSerializer() {
                OutputFormat outputFormat = new OutputFormat();
                outputFormat.setMethod(Method.XML);
                outputFormat.setEncoding(encodingInfo);
                outputFormat.setOmitXMLDeclaration(true);
                XMLSerializer xmlSerializer = new XMLSerializer(outputFormat);
                return xmlSerializer;
            }
View Full Code Here

            try {
                Document doc = BUILDER_FACTORY.newDocumentBuilder().newDocument();
                doc.appendChild(serializable.toXml(doc));
               
                OutputFormat format = new OutputFormat("xml", "UTF-8", true);
                XMLSerializer serializer = new XMLSerializer(out, format);
                serializer.setNamespaces(true);
                serializer.asDOMSerializer().serialize(doc);

            byte[] bytes = out.toByteArray();
            httpResponse.setContentType("text/xml; charset=UTF-8");
            httpResponse.setContentLength(bytes.length);
            httpResponse.getOutputStream().write(bytes);
View Full Code Here

        DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
        Document document = documentBuilder.parse(new ByteArrayInputStream(bos.toByteArray()));
        OutputFormat format = new OutputFormat();
        format.setIndenting(true);
        format.setIndent(2);
        XMLSerializer serializer = new XMLSerializer(System.out, format);
        System.out.println("-->Runtime SCDL model for composite " + composite.getName());
        serializer.serialize(document);
    }
View Full Code Here

        Document     document   = parser.getDocument(); //Our Grammar

        OutputFormat    format  = new OutputFormat( document );
        java.io.StringWriter outWriter = new java.io.StringWriter();
        XMLSerializer    serial = new XMLSerializer( outWriter,format);

        TraverseSchema tst = null;
        try {
            Element root   = document.getDocumentElement();// This is what we pass to TraverserSchema
            //serial.serialize( root );
View Full Code Here

        }
    }

    private void writeDocument(Document document, OutputStream out) throws IOException
    {
        XMLSerializer serializer = new XMLSerializer(out, new OutputFormat(document, null, true));
        serializer.serialize(document);
    }
View Full Code Here

        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

TOP

Related Classes of org.apache.xml.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.