Package javax.xml.stream

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


    protected void runTest() throws Throwable {
        XMLOutputFactory factory = staxImpl.newNormalizedXMLOutputFactory();
        XMLStreamWriter writer = factory.createXMLStreamWriter(new ByteArrayOutputStream());
        writer.writeStartDocument();
        writer.writeStartElement("root");
        writer.setPrefix("p", "urn:ns");
        writer.writeStartElement("child");
        assertEquals("p", writer.getPrefix("urn:ns"));
        writer.writeEndElement();
        assertEquals("p", writer.getPrefix("urn:ns"));
View Full Code Here


        XMLOutputFactory factory = staxImpl.newNormalizedXMLOutputFactory();
        XMLStreamWriter writer = factory.createXMLStreamWriter(new ByteArrayOutputStream());
        writer.writeStartDocument();
        writer.writeStartElement("root");
        writer.setPrefix("p", "urn:ns");
        writer.writeStartElement("child");
        assertEquals("p", writer.getPrefix("urn:ns"));
        writer.writeEndElement();
        assertEquals("p", writer.getPrefix("urn:ns"));
        writer.writeEndElement();
        writer.writeEndDocument();
View Full Code Here

            {
               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

               // add properties
               for (PropertyIterator pi = node.getProperties(); pi.hasNext();)
               {
                  Property curProperty = pi.nextProperty();
                  writer.writeStartElement(XML_PROPERTY);
                  writer.writeAttribute(XML_NAME, curProperty.getName());
                  String propertyHref = rootHref + curProperty.getPath();
                  writer.writeAttribute(XML_HREF, propertyHref);
                  writer.writeEndElement();
               }
View Full Code Here

               }
               // add subnodes
               for (NodeIterator ni = node.getNodes(); ni.hasNext();)
               {
                  Node childNode = ni.nextNode();
                  writer.writeStartElement(XML_NODE);
                  writer.writeAttribute(XML_NAME, childNode.getName());
                  String childNodeHref = rootHref + TextUtil.escape(childNode.getPath(), '%', true);
                  writer.writeAttribute(XML_HREF, childNodeHref);
                  writer.writeEndElement();
               }
View Full Code Here

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

         // <failure>
         writer.writeStartElement("failure");
View Full Code Here

         writer.writeStartElement("failureResult");
         nl(writer, pretty);
         indent(writer, 1, pretty);

         // <failure>
         writer.writeStartElement("failure");
         writer.writeCharacters(outcome.getFailureDescription());
         writer.writeEndElement();
         nl(writer, pretty);
         indent(writer, 1, pretty);
View Full Code Here

         writer.writeEndElement();
         nl(writer, pretty);
         indent(writer, 1, pretty);

         // <operationName>
         writer.writeStartElement("operationName");
         writer.writeCharacters(operationName);
         writer.writeEndElement();
         nl(writer, pretty);

         // </failureResult>
View Full Code Here

      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

      {
         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:");

         sw.writeEndElement(); // prop
         sw.writeEndElement(); // propfind
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.