Package org.apache.xml.serialize

Examples of org.apache.xml.serialize.XMLSerializer


        }
        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


            of.setDoctype(
                 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN",
                 "http://java.sun.com/dtd/web-app_2_3.dtd");

            FileWriter writer = new FileWriter("newWeb.xml");
            XMLSerializer serializer = new XMLSerializer(writer, of);
        Marshaller marsh = new Marshaller(serializer.asDocumentHandler());
        marsh.setDebug(debug);
        marsh.setMapping(mapping);
        marsh.marshal(config);

    }
View Full Code Here

        of.setLineWidth(600);
        of.setDoctype(getPublicId(), getDTDUri());

        OutputStreamWriter writer =
            new OutputStreamWriter(getOutputStream());
        XMLSerializer serializer = new XMLSerializer(writer, of);

        try {
            Marshaller marshaller =
                new Marshaller(serializer.asDocumentHandler());
            marshaller.setMapping(getCastorMapping());
            marshaller.marshal(object);
        } catch(IOException io) {
            throw io;
        } catch (Exception e) {
View Full Code Here

            FileWriter writer =
                new FileWriter(webAppsDir + webModule +
                                               System.getProperty("file.separator") + "WEB-INF"+
                                               System.getProperty("file.separator") + "web.xml");
            XMLSerializer serializer = new XMLSerializer(writer, of);
            try {
            Marshaller marshaller =
                new Marshaller(serializer.asDocumentHandler());
            marshaller.setMapping(mappingWebXml);
            marshaller.marshal(webApp);
            } catch (Exception e) {
                writer.close();
                e.printStackTrace(System.out);
View Full Code Here

            format.setIndenting(true);
            format.setIndent(2);
           
            // Write to workspace.xml
            FileOutputStream os = new FileOutputStream(new File(workspaceFile));
            XMLSerializer serializer = new XMLSerializer(os, format);
            serializer.serialize(document);
            os.close();
        } catch (Exception e) {
            throw new ServiceRuntimeException(e);
        }
    }
View Full Code Here

            format.setIndenting(true);
            format.setIndent(2);
           
            // Write to domain.composite
            FileOutputStream os = new FileOutputStream(new File(compositeFile));
            XMLSerializer serializer = new XMLSerializer(os, format);
            serializer.serialize(document);
        } catch (Exception e) {
            throw new ServiceRuntimeException(e);
        }
    }
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

        doc.appendChild(doc.createComment(" Autogenerated by JDBCToXMLSchema! "));

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

            if (out != null && exists()) {
                if (isMultiple()) {
                    Document doc = DomUtil.BUILDER_FACTORY.newDocumentBuilder().newDocument();
                    doc.appendChild(getProperty(JCR_VALUES).toXml(doc));
                    OutputFormat format = new OutputFormat("xml", "UTF-8", false);
                    XMLSerializer serializer = new XMLSerializer(out, format);
                    serializer.setNamespaces(true);
                    serializer.asDOMSerializer().serialize(doc);
                } else {
                    in = ((Property)item).getStream();
                    if (in != null) {
                        IOUtil.spool(in, out);
                    }
View Full Code Here

            try {
                Document doc = DomUtil.BUILDER_FACTORY.newDocumentBuilder().newDocument();
                doc.appendChild(serializable.toXml(doc));
               
                OutputFormat format = new OutputFormat("xml", "UTF-8", false);
                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

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.