Package javax.xml.stream

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


         throw new IOException("Could not create XML streaming writer.", e);
      }

      try
      {
         writer.writeStartDocument("UTF-8", "1.0");
         // root element <failureResult>
         nl(writer, pretty);
         writer.writeStartElement("failureResult");
         nl(writer, pretty);
         indent(writer, 1, pretty);
View Full Code Here


      NVPair contentTypePair = new NVPair("Content-Type", "text/xml");
      HTTPResponse response = setupRequest("PROPFIND", resource, new NVPair[]{depthPair, contentTypePair}, null, out);
      try
      {
         XMLStreamWriter sw = factory.createXMLStreamWriter(out, "UTF-8");
         sw.writeStartDocument("UTF-8", "1.0");
         sw.writeStartElement("D", "propfind", "DAV:");
         sw.writeNamespace("D", "DAV:");
         sw.writeStartElement("D", "prop", "DAV:");
         for (String prop : props)
            sw.writeEmptyElement("D", prop, "DAV:");
View Full Code Here

      HTTPResponse response = setupRequest("PROPPATCH", resource, new NVPair[]{contentTypePair}, null, out);

      try
      {
         XMLStreamWriter sw = factory.createXMLStreamWriter(out, "UTF-8");
         sw.writeStartDocument("UTF-8", "1.0");
         sw.writeStartElement("D", "propertyupdate", "DAV:");
         sw.writeNamespace("D", "DAV:");
         if (propsSet != null && propsSet.size() > 0)
         {
            sw.writeStartElement("D", "set", "DAV:");
View Full Code Here

         setupRequest("LOCK", resource, new NVPair[]{contentTypePair, timeoutPair, depthPair}, null, out);
      try
      {
         XMLOutputFactory factory = XMLOutputFactory.newInstance();
         XMLStreamWriter sw = factory.createXMLStreamWriter(out, "UTF-8");
         sw.writeStartDocument("UTF-8", "1.0");
         sw.writeStartElement("D", "lockinfo", "DAV:");
         sw.writeNamespace("D", "DAV:");
         sw.writeStartElement("D", "lockscope", "DAV:");
         if (isExclusive)
            sw.writeEmptyElement("D", "exclusive", "DAV:");
View Full Code Here

            try
            {
               XMLOutputFactory factory = XMLOutputFactory.newInstance();
               XMLStreamWriter writer = factory.createXMLStreamWriter(po, Constants.DEFAULT_ENCODING);

               writer.writeStartDocument(Constants.DEFAULT_ENCODING, "1.0");
               writer.writeStartElement(XML_NODE);
               writer.writeAttribute(PREFIX_XMLNS, PREFIX_LINK);
               writer.writeAttribute(XLINK_XMLNS, XLINK_LINK);
               writer.writeAttribute(XML_NAME, node.getName());
               writer.writeAttribute(XML_HREF, rootHref + TextUtil.escape(node.getPath(), '%', true));
View Full Code Here

public class StreamWriterBufferCreatorTest extends BaseBufferTestCase {
   
    public void testSimple() throws Exception {
        MutableXMLStreamBuffer buffer = new MutableXMLStreamBuffer();
        XMLStreamWriter writer = buffer.createFromXMLStreamWriter();
        writer.writeStartDocument();
        writer.writeStartElement("foo");
        writer.writeCharacters("body");
        writer.writeEndElement();
        writer.writeEndDocument();
View Full Code Here

   
    public void testNamespaces() throws Exception {
        MutableXMLStreamBuffer buffer = new MutableXMLStreamBuffer();
        XMLStreamWriter writer = buffer.createFromXMLStreamWriter();
       
        writer.writeStartDocument();
       
       
        writer.setDefaultNamespace("http://default");
        writer.setPrefix("ns1", "http://ns1");
        writer.setPrefix("ns2", "http://ns2");
View Full Code Here

                synchronized (factory) {
                    writer = factory.createXMLStreamWriter(os, encoding);
                }
            }
            if (MessageUtils.getContextualBoolean(message, FORCE_START_DOCUMENT, false)) {
                writer.writeStartDocument(encoding, "1.0");
                message.removeContent(OutputStream.class);
                message.put(OUTPUT_STREAM_HOLDER, os);
            }
        } catch (XMLStreamException e) {
            throw new Fault(new org.apache.cxf.common.i18n.Message("STREAM_CREATE_EXC", BUNDLE), e);
View Full Code Here

   {
      XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
      XMLStreamWriter writer =
         outputFactory.createXMLStreamWriter(PrivilegedFileHelper.fileOutputStream(bindingsStorePath), "UTF-8");

      writer.writeStartDocument("UTF-8", "1.0");
      writer.writeStartElement(BIND_REFERENCES_ELEMENT);

      for (Entry<String, Reference> entry : bindings.entrySet())
      {
         String bindName = entry.getKey();
View Full Code Here

    public void sendOut(MessageExchange exchange, NormalizedMessage outMsg, HttpServletRequest request,
        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);
    }
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.