Code example for Attr

Methods: setValue

        Assert.isNotNull(attributeName, "Attribute name may not be null");
        Assert.isNotNull(attributeValue, "Attribute value may not be null");
        final Document document = element.getOwnerDocument();
        final Attr attribute = constructAttribute(document, attributeName);
        if (isIDAttribute) {
            element.setIdAttributeNode(attribute, true);
     * Adds an attribute to the given element. The value of the attribute is the instant now + the given duration 
     * expressed in XML dateTime format. 
     * @param element element to which the attribute will be added, not null 
     * @param attributeName name of the attribute, not null 
     * @param duration duration, in milliseconds, must be greater than 0 
Experience pair programming with AI  Get Codota for Java