Package org.apache.xml.serialize

Examples of org.apache.xml.serialize.XMLSerializer


        }
    }

    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


            OutputFormat format = new OutputFormat(responseDocument);
            format.setOmitDocumentType(true);
            format.setOmitXMLDeclaration(false);
            format.setIndenting(false);

            XMLSerializer serializer = new XMLSerializer(os, format);
            try {
                serializer.asDOMSerializer();
                serializer.serialize(responseDocument.getDocumentElement());
            } catch (IOException e) {
                Debug.log(e, module);
                return;
            }
View Full Code Here

        OutputFormat format = new OutputFormat(requestDocument);
        format.setOmitDocumentType(true);
        format.setOmitXMLDeclaration(true);
        format.setIndenting(false);

        XMLSerializer serializer = new XMLSerializer(os, format);
        try {
            serializer.asDOMSerializer();
            serializer.serialize(requestDocument.getDocumentElement());
        } catch (IOException e) {
            throw new UspsRequestException("Error serializing requestDocument: " + e.getMessage());
        }

        String xmlString = os.toString();
View Full Code Here

        if (os == null) {
            Debug.logWarning("[UtilXml.writeXmlDocument] OutputStream was null, doing nothing", module);
            return;
        }

        XMLSerializer serializer = new XMLSerializer(os, format);
        serializer.asDOMSerializer();
        serializer.serialize(element);
    }
View Full Code Here

        OutputFormat format = new OutputFormat();
        format.setOmitDocumentType(true);
        format.setOmitXMLDeclaration(true);
        format.setIndenting(false);

        XMLSerializer serializer = new XMLSerializer(os, format);
        try {
            serializer.asDOMSerializer();
            serializer.serialize(requestDocument.getDocumentElement());
        } catch (IOException ioe) {
            throw new ClearCommerceException("Error serializing requestDocument: " + ioe.getMessage());
        }

        String xmlString = os.toString();
View Full Code Here

    /**
     * Creates a SAX content handler for importing XML data.
     */
    public ImportContentHandler() {
        this.buffer = new ByteArrayOutputStream();
        this.handler = new XMLSerializer(buffer, new OutputFormat());
    }
View Full Code Here

          if (extractFormat.equals(TEXT_FORMAT)) {
            serializer = new TextSerializer();
            serializer.setOutputCharStream(writer);
            serializer.setOutputFormat(new OutputFormat("Text", "UTF-8", true));
          } else {
            serializer = new XMLSerializer(writer, new OutputFormat("XML", "UTF-8", true));
          }
          if (xpathExpr != null) {
            Matcher matcher =
                    PARSER.parse(xpathExpr);
            serializer.startDocument();//The MatchingContentHandler does not invoke startDocument.  See http://tika.markmail.org/message/kknu3hw7argwiqin
View Full Code Here

        return parser.getDocument();
    }

    private XMLSerializer getSerializer() throws Exception{
        StringWriter writer = new StringWriter();
        XMLSerializer serializer = new XMLSerializer(writer, new OutputFormat("xml", "UTF-8", true));
        return serializer;
    }
View Full Code Here

    }

    /** convert a <code>Document</code>into a String */
    protected String toString(Document document) throws Exception{
        StringWriter writer = new StringWriter();
        XMLSerializer serializer = new XMLSerializer(writer, new OutputFormat("xml", "UTF-8", true));
        serializer.serialize(document);           
        writer.flush();
        return writer.toString();
    }
View Full Code Here

        name = doc.createTextNode("testDOM");
        testName.appendChild(name);

        OutputFormat format = new OutputFormat(doc, "UTF-8", true);         
        XMLSerializer serializer = new XMLSerializer(out, format);
     
        serializer.serialize(doc);      
        out.close()
       
        return doc;
    }
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.