@Test(expected = XMLStreamException.class) public void testWriteElement1b() throws XMLStreamException { XMLStreamWriter writer = createXMLStreamWriter(false); writer.writeStartElement("http: }
private void writeStartElement(String prefix, String localPart, String namespaceURI, boolean emptyElement) throws XMLStreamException { if (localPart == null) { throw new XMLStreamException("Local name must not be null"); } boolean writeNamespace = false; if (prefix == null) { if (repairingNamespaces != null) { prefix = repairingNamespaces.get(namespaceURI); if (prefix == null) { if (XMLConstants.NULL_NS_URI.equals(getScope().getNamespaceURI(XMLConstants.DEFAULT_NS_PREFIX))) { prefix = XMLConstants.DEFAULT_NS_PREFIX; } else { int index = 1; while (getScope().getNamespaceURI("ns" + index) == null) { index++; } prefix = index == 1 ? "ns" : "ns" + index; } } writeNamespace = true; } else { throw new XMLStreamException("Namespace URI has not been bound to a prefix: " + namespaceURI); } } ensureStartTagClosed(); T scopeInfo = writeStartElementTag(prefix, localPart, namespaceURI); scope = new XMLStreamWriterScope<T>(scope, prefix, localPart, namespaceURI, emptyElement); scope.setInfo(scopeInfo); if (writeNamespace) { writeNamespace(prefix, namespaceURI); } }
AbstractXMLStreamWriter implements XMLStreamWriter { private void writeStartElement(String prefix, String localPart, String namespaceURI, boolean emptyElement) throws XMLStreamException { if (localPart == null) { throw new XMLStreamException("Local name must not be null"); } boolean writeNamespace = false; if (prefix == null) { if (repairingNamespaces != null) { prefix = repairingNamespaces.get(namespaceURI); if (prefix == null) { if (XMLConstants.NULL_NS_URI.equals(getScope().getNamespaceURI(XMLConstants.DEFAULT_NS_PREFIX))) { prefix = XMLConstants.DEFAULT_NS_PREFIX; } else { int index = 1; while (getScope().getNamespaceURI("ns" + index) == null) { index++; } prefix = index == 1 ? "ns" : "ns" + index; } } writeNamespace = true; } else { throw new XMLStreamException("Namespace URI has not been bound to a prefix: " + namespaceURI); } } ensureStartTagClosed(); T scopeInfo = writeStartElementTag(prefix, localPart, namespaceURI); scope = new XMLStreamWriterScope<T>(scope, prefix, localPart, namespaceURI, emptyElement); scope.setInfo(scopeInfo); if (writeNamespace) { writeNamespace(prefix, namespaceURI); } } }
AbstractXMLStreamWriter implements XMLStreamWriter { private void writeStartElement(String prefix, String localPart, String namespaceURI, boolean emptyElement) throws XMLStreamException { if (localPart == null) { throw new XMLStreamException("Local name must not be null"); } boolean writeNamespace = false; if (prefix == null) { if (repairingNamespaces != null) { prefix = repairingNamespaces.get(namespaceURI); if (prefix == null) { if (XMLConstants.NULL_NS_URI.equals(getScope().getNamespaceURI(XMLConstants.DEFAULT_NS_PREFIX))) { prefix = XMLConstants.DEFAULT_NS_PREFIX; } else { int index = 1; while (getScope().getNamespaceURI("ns" + index) == null) { index++; } prefix = index == 1 ? "ns" : "ns" + index; } } writeNamespace = true; } else { throw new XMLStreamException("Namespace URI has not been bound to a prefix: " + namespaceURI); } } ensureStartTagClosed(); T scopeInfo = writeStartElementTag(prefix, localPart, namespaceURI); scope = new XMLStreamWriterScope<T>(scope, prefix, localPart, namespaceURI, emptyElement); scope.setInfo(scopeInfo); if (writeNamespace) { writeNamespace(prefix, namespaceURI); } } AbstractXMLStreamWriter(T rootInfo, boolean repairingNamespaces);  AbstractXMLStreamWriter(T rootInfo, Map<String, String> repairingNamespaces); }
AbstractXMLStreamWriter implements XMLStreamWriter { private void writeStartElement(String prefix, String localPart, String namespaceURI, boolean emptyElement) throws XMLStreamException { if (localPart == null) { throw new XMLStreamException("Local name must not be null"); } boolean writeNamespace = false; if (prefix == null) { if (repairingNamespaces != null) { prefix = repairingNamespaces.get(namespaceURI); if (prefix == null) { if (XMLConstants.NULL_NS_URI.equals(getScope().getNamespaceURI(XMLConstants.DEFAULT_NS_PREFIX))) { prefix = XMLConstants.DEFAULT_NS_PREFIX; } else { int index = 1; while (getScope().getNamespaceURI("ns" + index) == null) { index++; } prefix = index == 1 ? "ns" : "ns" + index; } } writeNamespace = true; } else { throw new XMLStreamException("Namespace URI has not been bound to a prefix: " + namespaceURI); } } ensureStartTagClosed(); T scopeInfo = writeStartElementTag(prefix, localPart, namespaceURI); scope = new XMLStreamWriterScope<T>(scope, prefix, localPart, namespaceURI, emptyElement); scope.setInfo(scopeInfo); if (writeNamespace) { writeNamespace(prefix, namespaceURI); } } AbstractXMLStreamWriter(T rootInfo, boolean repairingNamespaces);  AbstractXMLStreamWriter(T rootInfo, Map<String, String> repairingNamespaces); @Override void writeStartElement(String localName); @Override void writeStartElement(String namespaceURI, String localName); @Override void writeStartElement(String prefix, String localName, String namespaceURI); @Override void writeEndElement(); @Override void writeEmptyElement(String localName); @Override void writeEmptyElement(String namespaceURI, String localName); @Override void writeEmptyElement(String prefix, String localName, String namespaceURI); @Override void writeAttribute(String localName, String value); @Override void writeAttribute(String namespaceURI, String localName, String value); @Override void writeAttribute(String prefix, String namespaceURI, String localName, String value); @Override void writeCharacters(String text); @Override void writeCharacters(char[] text, int start, int length); @Override void writeCData(String data); @Override void writeStartDocument(); @Override void writeStartDocument(String version); @Override void writeStartDocument(String encoding, String version); @Override void writeEndDocument(); @Override void close(); @Override void writeNamespace(String prefix, String namespaceURI); @Override void writeDefaultNamespace(String namespaceURI); @Override String getPrefix(String namespaceURI); @Override void setPrefix(String prefix, String namespaceURI); @Override void setDefaultNamespace(String namespaceURI); @Override void setNamespaceContext(NamespaceContext context); @Override NamespaceContext getNamespaceContext(); @Override void writeComment(String data); @Override void writeProcessingInstruction(String target); @Override void writeProcessingInstruction(String target, String data); @Override void writeDTD(String dtd); @Override void writeEntityRef(String name); @Override Object getProperty(String name); }
AbstractXMLStreamWriter implements XMLStreamWriter { private void writeStartElement(String prefix, String localPart, String namespaceURI, boolean emptyElement) throws XMLStreamException { if (localPart == null) { throw new XMLStreamException("Local name must not be null"); } boolean writeNamespace = false; if (prefix == null) { if (repairingNamespaces != null) { prefix = repairingNamespaces.get(namespaceURI); if (prefix == null) { if (XMLConstants.NULL_NS_URI.equals(getScope().getNamespaceURI(XMLConstants.DEFAULT_NS_PREFIX))) { prefix = XMLConstants.DEFAULT_NS_PREFIX; } else { int index = 1; while (getScope().getNamespaceURI("ns" + index) == null) { index++; } prefix = index == 1 ? "ns" : "ns" + index; } } writeNamespace = true; } else { throw new XMLStreamException("Namespace URI has not been bound to a prefix: " + namespaceURI); } } ensureStartTagClosed(); T scopeInfo = writeStartElementTag(prefix, localPart, namespaceURI); scope = new XMLStreamWriterScope<T>(scope, prefix, localPart, namespaceURI, emptyElement); scope.setInfo(scopeInfo); if (writeNamespace) { writeNamespace(prefix, namespaceURI); } } AbstractXMLStreamWriter(T rootInfo, boolean repairingNamespaces);  AbstractXMLStreamWriter(T rootInfo, Map<String, String> repairingNamespaces); @Override void writeStartElement(String localName); @Override void writeStartElement(String namespaceURI, String localName); @Override void writeStartElement(String prefix, String localName, String namespaceURI); @Override void writeEndElement(); @Override void writeEmptyElement(String localName); @Override void writeEmptyElement(String namespaceURI, String localName); @Override void writeEmptyElement(String prefix, String localName, String namespaceURI); @Override void writeAttribute(String localName, String value); @Override void writeAttribute(String namespaceURI, String localName, String value); @Override void writeAttribute(String prefix, String namespaceURI, String localName, String value); @Override void writeCharacters(String text); @Override void writeCharacters(char[] text, int start, int length); @Override void writeCData(String data); @Override void writeStartDocument(); @Override void writeStartDocument(String version); @Override void writeStartDocument(String encoding, String version); @Override void writeEndDocument(); @Override void close(); @Override void writeNamespace(String prefix, String namespaceURI); @Override void writeDefaultNamespace(String namespaceURI); @Override String getPrefix(String namespaceURI); @Override void setPrefix(String prefix, String namespaceURI); @Override void setDefaultNamespace(String namespaceURI); @Override void setNamespaceContext(NamespaceContext context); @Override NamespaceContext getNamespaceContext(); @Override void writeComment(String data); @Override void writeProcessingInstruction(String target); @Override void writeProcessingInstruction(String target, String data); @Override void writeDTD(String dtd); @Override void writeEntityRef(String name); @Override Object getProperty(String name);  }