add_element(element, attrs=nil)
Instance Public methods
Adds a child to this element, optionally setting attributes in the element.
- element
-
optional. If Element, the element is added. Otherwise, a new Element is constructed with the argument (see Element.initialize).
- attrs
-
If supplied, must be a Hash containing String name,value pairs, which will be used to set the attributes of the new Element.
- Returns
-
the Element that was added
1 2 3 4 | el = doc.add_element 'my-tag' el = doc.add_element 'my-tag' , { 'attr1' => 'val1' , 'attr2' => 'val2' } el = Element. new 'my-tag' doc.add_element el |
Please login to continue.