Package javax.xml.stream

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


  @Test
  public void testRootArray() throws Exception {
    StringWriter result = new StringWriter();
    XMLStreamWriter writer = new JsonXMLOutputFactory().createXMLStreamWriter(result);
    writer.writeStartDocument();
    writer.writeProcessingInstruction(JsonXMLStreamConstants.MULTIPLE_PI_TARGET, "alice");
    writer.writeStartElement("alice");
    writer.writeCharacters("bob");
    writer.writeEndElement();
    writer.writeStartElement("alice");
    writer.writeCharacters("bob");
View Full Code Here


    StringWriter result = new StringWriter();
    JsonXMLOutputFactory factory = new JsonXMLOutputFactory();
    factory.setProperty(JsonXMLOutputFactory.PROP_VIRTUAL_ROOT, new QName("alice"));
    XMLStreamWriter writer = factory.createXMLStreamWriter(result);
    writer.writeStartDocument();
    writer.writeProcessingInstruction(JsonXMLStreamConstants.MULTIPLE_PI_TARGET, "alice");
    writer.writeStartElement("alice");
    writer.writeCharacters("bob");
    writer.writeEndElement();
    writer.writeStartElement("alice");
    writer.writeCharacters("bob");
View Full Code Here

   */
  @Test
  public void testDocumentArray() throws Exception {
    StringWriter result = new StringWriter();
    XMLStreamWriter writer = new JsonXMLOutputFactory().createXMLStreamWriter(result);
    writer.writeProcessingInstruction(JsonXMLStreamConstants.MULTIPLE_PI_TARGET);
    writer.writeStartDocument();
    writer.writeStartElement("alice");
    writer.writeCharacters("bob");
    writer.writeEndElement();
    writer.writeEndDocument();
View Full Code Here

    StringWriter result = new StringWriter();
    XMLStreamWriter writer = createXmlStreamWriter(result);
    writer.writeStartDocument();
    writer.writeStartElement("alice");
    writer.writeAttribute("edgar", "999");
    writer.writeProcessingInstruction(JsonXMLStreamConstants.MULTIPLE_PI_TARGET);
    writer.writeStartElement("bob");
    writer.writeCharacters("123");
    writer.writeEndElement();
    writer.writeStartElement("bob");
    writer.writeCharacters("123.4");
View Full Code Here

  @Test
  public void testSimpleValueArray() throws Exception {
    StringWriter result = new StringWriter();
    XMLStreamWriter writer = new JsonXMLOutputFactory().createXMLStreamWriter(result);
    writer.writeProcessingInstruction(JsonXMLStreamConstants.MULTIPLE_PI_TARGET);
    writer.writeCharacters("edgar");
    writer.writeCharacters("david");
    writer.close();
    Assert.assertEquals("[\"edgar\",\"david\"]", result.toString());
  }
View Full Code Here

  @Test
  public void testMixedValueArray() throws Exception {
    StringWriter result = new StringWriter();
    XMLStreamWriter writer = new JsonXMLOutputFactory().createXMLStreamWriter(result);
    writer.writeProcessingInstruction(JsonXMLStreamConstants.MULTIPLE_PI_TARGET);
    writer.writeCharacters("edgar");
    writer.writeStartDocument();
    writer.writeStartElement("alice");
    writer.writeCharacters("bob");
    writer.writeEndElement();
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.