in addition to these attributesall nodes have the following methods typicallythese are used to manipulate the tree structure appendchild(childadds new child nodechildto the new child is added at the end of any other children clonenode(deepmakes copy of the node if deep is trueall child nodes are also cloned hasattributes(returns true if the node has any attributes haschildnodes(returns true if the node has any children insertbefore(newchildichildinserts new childnewchildbefore another childichild ichild must already be child of issamenode(otherreturns true if the node other refers to the same dom node as normalize(joins adjacent text nodes into single text node removechild(childremoves child child from replacechild(newchild,oldchildreplaces the child oldchild with newchild oldchild must already be child of although there are many different types of nodes that might appear in treeit is most common to work with documentelementand text nodes each is briefly described next document nodes document node appears at the top of the entire document tree and represents the entire document as whole it has the following methods and attributesd documentelement contains the root element of the entire document getelementsbytagname(tagnamesearches all child nodes and returns list of elements with given tag name tagname getelementsbytagnamens(namespaceurilocalnamesearches all child nodes and returns list of elements with given namespace uri and local name the returned list is an object of type nodelist lib fl ff