@Test(expected = XMLStreamException.class) public void testElementMultipleRoots() throws XMLStreamException { XMLStreamWriter writer = new JsonXMLOutputFactory().createXMLStreamWriter(new StringWriter()); writer.writeStartDocument(); writer.writeStartElement("foo"); writer.writeEndElement(); writer.writeStartElement("bar"); }
@Override public void writeStartDocument(String encoding, String version) throws XMLStreamException { super.writeStartDocument(encoding, version); try { target.startObject(); } catch (IOException e) { throw new XMLStreamException("Cannot start document", e); } getScope().getInfo().startObjectWritten = true; }
JsonXMLStreamWriter extends AbstractXMLStreamWriter<JsonXMLStreamWriter.ScopeInfo> { @Override public void writeStartDocument(String encoding, String version) throws XMLStreamException { super.writeStartDocument(encoding, version); try { target.startObject(); } catch (IOException e) { throw new XMLStreamException("Cannot start document", e); } getScope().getInfo().startObjectWritten = true; } }
JsonXMLStreamWriter extends AbstractXMLStreamWriter<JsonXMLStreamWriter.ScopeInfo> { @Override public void writeStartDocument(String encoding, String version) throws XMLStreamException { super.writeStartDocument(encoding, version); try { target.startObject(); } catch (IOException e) { throw new XMLStreamException("Cannot start document", e); } getScope().getInfo().startObjectWritten = true; } JsonXMLStreamWriter(JsonStreamTarget target, boolean repairNamespaces, boolean multiplePI, char namespaceSeparator, boolean namespaceDeclarations);  JsonXMLStreamWriter(JsonStreamTarget target, Map<String, String> repairNamespaces, boolean multiplePI, char namespaceSeparator, boolean namespaceDeclarations);  JsonXMLStreamWriter(JsonStreamTarget target, Map<String, String> repairNamespaces, boolean multiplePI, char namespaceSeparator, boolean namespaceDeclarations, String textProperty, String attributePrefix); }
JsonXMLStreamWriter extends AbstractXMLStreamWriter<JsonXMLStreamWriter.ScopeInfo> { @Override public void writeStartDocument(String encoding, String version) throws XMLStreamException { super.writeStartDocument(encoding, version); try { target.startObject(); } catch (IOException e) { throw new XMLStreamException("Cannot start document", e); } getScope().getInfo().startObjectWritten = true; } JsonXMLStreamWriter(JsonStreamTarget target, boolean repairNamespaces, boolean multiplePI, char namespaceSeparator, boolean namespaceDeclarations);  JsonXMLStreamWriter(JsonStreamTarget target, Map<String, String> repairNamespaces, boolean multiplePI, char namespaceSeparator, boolean namespaceDeclarations);  JsonXMLStreamWriter(JsonStreamTarget target, Map<String, String> repairNamespaces, boolean multiplePI, char namespaceSeparator, boolean namespaceDeclarations, String textProperty, String attributePrefix); @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); }
JsonXMLStreamWriter extends AbstractXMLStreamWriter<JsonXMLStreamWriter.ScopeInfo> { @Override public void writeStartDocument(String encoding, String version) throws XMLStreamException { super.writeStartDocument(encoding, version); try { target.startObject(); } catch (IOException e) { throw new XMLStreamException("Cannot start document", e); } getScope().getInfo().startObjectWritten = true; } JsonXMLStreamWriter(JsonStreamTarget target, boolean repairNamespaces, boolean multiplePI, char namespaceSeparator, boolean namespaceDeclarations);  JsonXMLStreamWriter(JsonStreamTarget target, Map<String, String> repairNamespaces, boolean multiplePI, char namespaceSeparator, boolean namespaceDeclarations);  JsonXMLStreamWriter(JsonStreamTarget target, Map<String, String> repairNamespaces, boolean multiplePI, char namespaceSeparator, boolean namespaceDeclarations, String textProperty, String attributePrefix); @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);  }