DomElement->set_attribute Adds new attribute Description boolDomElement->set_attribute stringname stringvalue Sets an attribute with name name to the given value. If the attribute does not exist, it will be created. Setting an attribute create_element("para"); $newnode = $doc->append_child($node); $newnode->set_attribute("align", "left"); ?> ]]> See also domelement_get_attribute.