@Test public void testWriteAttribute() throws IOException, XMLStreamException { out.writeStartElement("testElement1"); out.writeAttribute("attr1", "val1"); out.writeEndElement(); assertOutput("<testElement1 attr1=\"val1\"></testElement1>"); out.writeStartElement("testElement2"); out.writeAttribute(DEFAULT_NAMESPACE, "attr2", "val2"); out.writeEndElement(); assertOutput("<testElement2 dprefix:attr2=\"val2\"></testElement2>"); out.writeStartElement("testElement3"); out.writeAttribute(PREFIX, NAMESPACE, "attr3", "val3"); out.writeEndElement(); assertOutput("<testElement3 prefix:attr3=\"val3\"></testElement3>"); }
@Override public void writeAttribute(final String localName, final String value) throws XMLStreamException { if (localName == null) { throw new IllegalArgumentException("localName"); } if (value == null) { throw new IllegalArgumentException("value"); } next.writeAttribute(localName, value); }
IndentingXMLStreamWriter implements XMLStreamWriter { @Override public void writeAttribute(final String localName, final String value) throws XMLStreamException { if (localName == null) { throw new IllegalArgumentException("localName"); } if (value == null) { throw new IllegalArgumentException("value"); } next.writeAttribute(localName, value); } }
IndentingXMLStreamWriter implements XMLStreamWriter { @Override public void writeAttribute(final String localName, final String value) throws XMLStreamException { if (localName == null) { throw new IllegalArgumentException("localName"); } if (value == null) { throw new IllegalArgumentException("value"); } next.writeAttribute(localName, value); } IndentingXMLStreamWriter(final XMLStreamWriter next); }
IndentingXMLStreamWriter implements XMLStreamWriter { @Override public void writeAttribute(final String localName, final String value) throws XMLStreamException { if (localName == null) { throw new IllegalArgumentException("localName"); } if (value == null) { throw new IllegalArgumentException("value"); } next.writeAttribute(localName, value); } IndentingXMLStreamWriter(final XMLStreamWriter next); @Override void close(); @Override void flush(); @Override NamespaceContext getNamespaceContext(); @Override String getPrefix(final String uri); @Override Object getProperty(final String name); @Override void setDefaultNamespace(final String uri); @Override void setNamespaceContext(final NamespaceContext context); @Override void setPrefix(final String prefix, final String uri); @Override void writeAttribute(final String localName, final String value); @Override void writeAttribute(final String namespaceURI, final String localName, final String value); @Override void writeAttribute(final String prefix, final String namespaceURI, final String localName,
            final String value); @Override void writeCData(final String data); @Override void writeCharacters(final String text); @Override void writeCharacters(final char[] text, final int start, final int len); @Override void writeComment(final String data); @Override void writeDTD(final String dtd); @Override void writeDefaultNamespace(final String namespaceURI); @Override void writeEmptyElement(final String localName); @Override void writeEmptyElement(final String namespaceURI, final String localName); @Override void writeEmptyElement(final String prefix, final String localName, final String namespaceURI); @Override void writeEndDocument(); @Override void writeEndElement(); @Override void writeEntityRef(final String name); @Override void writeNamespace(final String prefix, final String namespaceURI); @Override void writeProcessingInstruction(final String target); @Override void writeProcessingInstruction(final String target, final String data); @Override void writeStartDocument(); @Override void writeStartDocument(final String version); @Override void writeStartDocument(final String encoding, final String version); @Override void writeStartElement(final String localName); @Override void writeStartElement(final String namespaceURI, final String localName); @Override void writeStartElement(final String prefix, final String localName, final String namespaceURI); }
IndentingXMLStreamWriter implements XMLStreamWriter { @Override public void writeAttribute(final String localName, final String value) throws XMLStreamException { if (localName == null) { throw new IllegalArgumentException("localName"); } if (value == null) { throw new IllegalArgumentException("value"); } next.writeAttribute(localName, value); } IndentingXMLStreamWriter(final XMLStreamWriter next); @Override void close(); @Override void flush(); @Override NamespaceContext getNamespaceContext(); @Override String getPrefix(final String uri); @Override Object getProperty(final String name); @Override void setDefaultNamespace(final String uri); @Override void setNamespaceContext(final NamespaceContext context); @Override void setPrefix(final String prefix, final String uri); @Override void writeAttribute(final String localName, final String value); @Override void writeAttribute(final String namespaceURI, final String localName, final String value); @Override void writeAttribute(final String prefix, final String namespaceURI, final String localName,
            final String value); @Override void writeCData(final String data); @Override void writeCharacters(final String text); @Override void writeCharacters(final char[] text, final int start, final int len); @Override void writeComment(final String data); @Override void writeDTD(final String dtd); @Override void writeDefaultNamespace(final String namespaceURI); @Override void writeEmptyElement(final String localName); @Override void writeEmptyElement(final String namespaceURI, final String localName); @Override void writeEmptyElement(final String prefix, final String localName, final String namespaceURI); @Override void writeEndDocument(); @Override void writeEndElement(); @Override void writeEntityRef(final String name); @Override void writeNamespace(final String prefix, final String namespaceURI); @Override void writeProcessingInstruction(final String target); @Override void writeProcessingInstruction(final String target, final String data); @Override void writeStartDocument(); @Override void writeStartDocument(final String version); @Override void writeStartDocument(final String encoding, final String version); @Override void writeStartElement(final String localName); @Override void writeStartElement(final String namespaceURI, final String localName); @Override void writeStartElement(final String prefix, final String localName, final String namespaceURI);  }