public void attribute()

in util/src/main/java/org/apache/jsieve/util/XmlOut.java [468:492]


    public void 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.");
        }
        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('\'');
        writeAttributeContent(value);
        writer.write('\'');
        currentAttributes.add(name);
    }