Package javax.xml.stream

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


        message.setContent(XMLStreamWriter.class, writer);
        message.put(org.apache.cxf.message.Message.REQUESTOR_ROLE, true);
        outChain.doIntercept(message);
        XMLStreamWriter xtw = message.getContent(XMLStreamWriter.class);
        if (xtw != null) {
            xtw.writeEndDocument();
            xtw.close();
        }

        os.flush();
        is.close();
View Full Code Here


        HttpServletResponse response) throws Exception {
        XMLStreamReader reader = transformer.toXMLStreamReader(outMsg.getContent());
        XMLStreamWriter writer = transformer.getOutputFactory().createXMLStreamWriter(response.getWriter());
        writer.writeStartDocument();
        XMLStreamHelper.copy(reader, writer);
        writer.writeEndDocument();
        writer.flush();
        response.setStatus(HttpServletResponse.SC_OK);
    }

    public void sendFault(MessageExchange exchange, Fault fault, HttpServletRequest request,
View Full Code Here

        PrintWriter pw = new PrintWriter(sw);
        error.printStackTrace(pw);
        pw.close();
        writer.writeCData(sw.toString());
        writer.writeEndElement();
        writer.writeEndDocument();
    }

    public void sendAccepted(MessageExchange exchange, HttpServletRequest request, HttpServletResponse response)
        throws Exception {
        response.setStatus(HttpServletResponse.SC_ACCEPTED);
View Full Code Here

        throws JAXBException {
        CachedOutputStream out = new CachedOutputStream();
        try {
            XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(out);
            StaxUtils.copy(new StaxSource(reader), writer);
            writer.writeEndDocument();
            writer.flush();
            writer.close();
            return unmarshalFromInputStream(unmarshaller, out.getInputStream(), mt);
        } catch (Exception ex) {
            throw ExceptionUtils.toBadRequestException(ex, null);
View Full Code Here

                }
            } else if (message.getSource() != null) {
                writeContents(writer);
            }
        }
        writer.writeEndDocument();
        writer.flush();
    }

    private void writeMultipartMessage(OutputStream out) throws Exception {
        Session session = Session.getDefaultInstance(new Properties(), null);
View Full Code Here

                XMLStreamWriter xtw = message.getContent(XMLStreamWriter.class);
                if (xtw != null) {
                    xtw.writeEndElement();           
                    // Write Envelope end element
                    xtw.writeEndElement();
                    xtw.writeEndDocument();
                   
                    xtw.flush();
                }
            } catch (XMLStreamException e) {
                throw new SoapFault(new org.apache.cxf.common.i18n.Message("XML_WRITE_EXC", BUNDLE), e,
View Full Code Here

                switch (reader.getEventType()) {
                case XMLEvent.START_DOCUMENT:
                    writer.writeStartDocument();
                    break;
                case XMLEvent.END_DOCUMENT:
                    writer.writeEndDocument();
                    break;
                case XMLEvent.START_ELEMENT:
                    writer.writeStartElement(reader.getName().getLocalPart());
                    break;
                case XMLEvent.CHARACTERS:
View Full Code Here

        streamWriter.setDefaultNamespace(namespace);
        streamWriter.writeStartElement(namespace, "root");
        streamWriter.writeDefaultNamespace(namespace);
        streamWriter.writeStartElement(namespace, "child");
        streamWriter.writeCharacters("text");
        streamWriter.writeEndDocument();
        streamWriter.flush();

        StringWriter writer = new StringWriter();
        body.serialize(writer);
View Full Code Here

         writer.writeEndElement();
         writer.writeEndElement();
      }

      writer.writeEndElement();
      writer.writeEndDocument();
   }

   /**
    * Import references from xml-file.
    *
 
View Full Code Here

                  String childNodeHref = rootHref + TextUtil.escape(childNode.getPath(), '%', true);
                  writer.writeAttribute(XML_HREF, childNodeHref);
                  writer.writeEndElement();
               }
               writer.writeEndElement();
               writer.writeEndDocument();
            }
            catch (RepositoryException e)
            {
               LOG.error("Error has occured : ", e);
            }
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.