Package javax.xml.stream

Examples of javax.xml.stream.XMLStreamWriter.writeStartDocument()


            // ok, now the namespace map has all the prefixes.
           
            String enc = HttpUtils.getSetEncoding(m, headers, "UTF-8");
           
            XMLStreamWriter xmlStreamWriter = createStreamWriter(aegisType.getSchemaType(), enc, os);
            xmlStreamWriter.writeStartDocument();
            StaxUtils.copy(dom, xmlStreamWriter);
            // Jettison needs, and StaxUtils.copy doesn't do it.
            xmlStreamWriter.writeEndDocument();
            xmlStreamWriter.flush();
            xmlStreamWriter.close();
View Full Code Here


       
        try
        {
            xmlWriter = new XMLFormatter(
                    xmlOutputFactory.createXMLStreamWriter(stringWriter));
            xmlWriter.writeStartDocument();
           
            xmlWriter.writeStartElement("rdf", "RDF", RDF_URI);
            xmlWriter.setPrefix("rdf", RDF_URI);
            xmlWriter.writeNamespace("rdf", RDF_URI);
           
View Full Code Here

                try {
                    writer = new FileWriter(tempFile);
                    // wrap the writer with an xml stream writer
                    xmlWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(writer);
                    // prepare the dump xml
                    xmlWriter.writeStartDocument();
                    createMetaElement(xmlWriter, workingDir, checkInPath);
                    xmlWriter.writeEndDocument();
                } finally {
                    try {
                        if (xmlWriter != null) {
View Full Code Here

   public void testStreamWriter() throws Exception
   {
      ByteArrayOutputStream stream = new ByteArrayOutputStream();
      XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(stream);
      writer.writeStartDocument();
      writer.writeComment("hello");
      writer.writeStartElement("root");
      writer.writeAttribute("some-attribute", "10");
      writer.close();
      assertEquals("<?xml version='1.0' encoding='UTF-8'?><!--hello--><root some-attribute=\"10\"></root>", stream.toString());
View Full Code Here

                // we have to do this little hack.
                XMLStreamReader reader = (XMLStreamReader)src;
                XMLStreamWriter writer = getXMLOutputFactory().createXMLStreamWriter(out);
               
                try {
                    writer.writeStartDocument();
                    XMLUtils.copy(reader, writer);
                    writer.writeEndDocument();
                } finally {
                    writer.close();
                    reader.close();
View Full Code Here

        }
    }

    private void writeSimpleMessage(OutputStream out) throws Exception {
        XMLStreamWriter writer = marshaler.getOutputFactory().createXMLStreamWriter(out);
        writer.writeStartDocument();
        if (marshaler.isSoap()) {
            writeSoapEnvelope(writer);
        } else {
            if (message.hasHeaders()) {
                throw new IllegalStateException("SOAP headers found on non-soap message");
View Full Code Here

    private static byte[] copy(XMLStreamReader parser) throws Exception {
        // create a writer
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(out);

        writer.writeStartDocument();

        // copy subtree
        int level = 1;
        while (next(parser)) {
            int event = parser.getEventType();
View Full Code Here

        writer.setPrefix(PREFIX_ATOM, Constants.NAMESPACE_ATOM);
        writer.setPrefix(PREFIX_CMIS, Constants.NAMESPACE_CMIS);
        writer.setPrefix(PREFIX_RESTATOM, Constants.NAMESPACE_RESTATOM);

        // start doc
        writer.writeStartDocument();

        // start entry
        writer.writeStartElement(Constants.NAMESPACE_ATOM, TAG_ENTRY);
        writer.writeNamespace(PREFIX_ATOM, Constants.NAMESPACE_ATOM);
        writer.writeNamespace(PREFIX_CMIS, Constants.NAMESPACE_CMIS);
View Full Code Here

        };

        xmlSecurityStreamWriter.setNamespaceContext(namespaceContext);
        stdXmlStreamWriter.setNamespaceContext(namespaceContext);
        xmlSecurityStreamWriter.writeStartDocument("UTF-8", "1.0");
        stdXmlStreamWriter.writeStartDocument("UTF-8", "1.0");

        xmlSecurityStreamWriter.writeDTD("<!DOCTYPE foobar [\n\t<!ENTITY x0 \"hello\">\n]>");
        stdXmlStreamWriter.writeDTD("<!DOCTYPE foobar [\n\t<!ENTITY x0 \"hello\">\n]>");

        xmlSecurityStreamWriter.writeStartElement("test1");
View Full Code Here

        writer.setPrefix(PREFIX_ATOM, Constants.NAMESPACE_ATOM);
        writer.setPrefix(PREFIX_CMIS, Constants.NAMESPACE_CMIS);
        writer.setPrefix(PREFIX_RESTATOM, Constants.NAMESPACE_RESTATOM);

        // start doc
        writer.writeStartDocument();

        // start entry
        writer.writeStartElement(Constants.NAMESPACE_ATOM, TAG_ENTRY);
        writer.writeNamespace(PREFIX_ATOM, Constants.NAMESPACE_ATOM);
        writer.writeNamespace(PREFIX_CMIS, Constants.NAMESPACE_CMIS);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.