* or {@link #closeElement()} or before any call to {@link #openElement(CharSequence)}
*/
public IXmlWriter attribute(CharSequence name, CharSequence value) throws IOException {
if (elementNames.isEmpty()) {
if (elementsWritten) {
throw new OperationNotAllowedException("Root element has already been closed.");
} else {
throw new OperationNotAllowedException("Close called before an element has been opened.");
}
}
if (!isValidName(name)) {
throw new InvalidXmlException("'" + name + "' is not a valid attribute name.");
}