### Question:
JsonXMLStreamWriter extends AbstractXMLStreamWriter<JsonXMLStreamWriter.ScopeInfo> { @Override public void close() throws XMLStreamException { super.close(); try { if (documentArray) { target.endArray(); } target.close(); } catch (IOException e) { throw new XMLStreamException("Close failed", e); } } JsonXMLStreamWriter(JsonStreamTarget target, boolean repairNamespaces, boolean multiplePI, char namespaceSeparator, boolean namespaceDeclarations);  JsonXMLStreamWriter(JsonStreamTarget target, boolean repairNamespaces, boolean multiplePI, char namespaceSeparator, boolean namespaceDeclarations,
                               boolean xmlNilReadWriteEnabled, boolean xmlWriteNullForEmptyElement); void writeAttribute(String prefix, String namespaceURI, String localName, String value); void writeNamespace(String prefix, String namespaceURI); @Override void writeStartDocument(String encoding, String version); @Override void writeEndDocument(); void writeStartArray(String fieldName); void writeEndArray(); @Override void close(); @Override void flush(); void writeNumber(Number value); void writeBoolean(Boolean value);  }### Answer:
@Test public void testSimpleValue() throws Exception { StringWriter result = new StringWriter(); XMLStreamWriter writer = new JsonXMLOutputFactory().createXMLStreamWriter(result); writer.writeCharacters("bob"); writer.close(); Assert.assertEquals("\"bob\"", result.toString()); }
@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()); }