} 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.");
}
if (!inElement) {
throw new InvalidXmlException("Attributes can only be written in elements");
}
if (currentAttributes.contains(name)) {
throw new InvalidXmlException("Each attribute can only be written once");
}
writer.write(' ');
rawWrite(name);
writer.write('=');
writer.write('\'');