Package org.apache.xml.serialize

Examples of org.apache.xml.serialize.OutputFormat


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


        fEmptySymbol = fSymbolTable.addSymbol("");
        fXmlSymbol = fSymbolTable.addSymbol("xml");
        fXmlnsSymbol = fSymbolTable.addSymbol("xmlns");
        fErrorBuffer.setLength(0);
        try {
            OutputFormat outputFormat = new OutputFormat();
            outputFormat.setIndenting(true);
            outputFormat.setLineSeparator(LineSeparator.Windows);
            outputFormat.setLineWidth(150);
            outputFormat.setOmitComments(false);
            outputFormat.setOmitDocumentType(false);
            outputFormat.setOmitXMLDeclaration(false);

            FileOutputStream fos = new FileOutputStream(PSVI_OUTPUT);
            _output = new BufferedOutputStream(fos);

            _encodingInfo = outputFormat.getEncodingInfo();
            _writer = _encodingInfo.getWriter(_output);

            _printer = new IndentPrinter( _writer, outputFormat );
        }
        catch (Exception e) {
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

                this.processingInstructions = processingInstructions;
                namespacePrefixMapper = null;
                xmlContent = null;

                // prepare the OutputFormat to output the XML as desired
                of = new OutputFormat();
                of.setMethod(Method.XML);
                String encoding = (String)marshaller.getProperty(Marshaller.JAXB_ENCODING);
                of.setEncoding(encoding == null ? encodingInfo : new OutputFormat(Method.XML,
                                                                                  encoding, true)
                    .getEncodingInfo());
                Boolean property =
                    (Boolean)marshaller.getProperty(Marshaller.JAXB_FORMATTED_OUTPUT);
                boolean formattedOutput = false;
View Full Code Here

                isXhtml = false;
                isXmlOpen = false;
            }

            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

            ByteArrayOutputStream out = new ByteArrayOutputStream();
            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();
View Full Code Here

        customBuilder.getModelProcessor().write(composite, writer, new ProcessorContext());
       
        // Parse and write again to pretty format it
        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

            e.printStackTrace();
        }

        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 {
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 XMLSerializer createXMLSerializer(Node node, Format fmt) {
        if(fmt==null) {
            fmt = Format.defaultFormat;
        }
        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

TOP

Related Classes of org.apache.xml.serialize.OutputFormat

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.