@@ -719,6 +719,14 @@ def unlink(self):
719719 Node .unlink (self )
720720
721721 def getAttribute (self , attname ):
722+ """Returns the value of the specified attribute.
723+
724+ Returns the value of the element's attribute named attname as
725+ a string. An empty string is returned if the element does not
726+ have such an attribute. Note that an empty string may also be
727+ returned as an explicitly given attribute value, use the
728+ hasAttribute method to distinguish these two cases.
729+ """
722730 if self ._attrs is None :
723731 return ""
724732 try :
@@ -829,6 +837,11 @@ def removeAttributeNode(self, node):
829837 removeAttributeNodeNS = removeAttributeNode
830838
831839 def hasAttribute (self , name ):
840+ """Checks whether the element has an attribute with the specified name.
841+
842+ Returns True if the element has an attribute with the specified name.
843+ Otherwise, returns False.
844+ """
832845 if self ._attrs is None :
833846 return False
834847 return name in self ._attrs
@@ -839,6 +852,11 @@ def hasAttributeNS(self, namespaceURI, localName):
839852 return (namespaceURI , localName ) in self ._attrsNS
840853
841854 def getElementsByTagName (self , name ):
855+ """Returns all descendant elements with the given tag name.
856+
857+ Returns the list of all descendant elements (not direct children
858+ only) with the specified tag name.
859+ """
842860 return _get_elements_by_tagName_helper (self , name , NodeList ())
843861
844862 def getElementsByTagNameNS (self , namespaceURI , localName ):
@@ -849,6 +867,11 @@ def __repr__(self):
849867 return "<DOM Element: %s at %#x>" % (self .tagName , id (self ))
850868
851869 def writexml (self , writer , indent = "" , addindent = "" , newl = "" ):
870+ """Write an XML element to a file-like object
871+
872+ Write the element to the writer object that must provide
873+ a write method (e.g. a file or StringIO object).
874+ """
852875 # indent = current indentation
853876 # addindent = indentation to add to higher levels
854877 # newl = newline string
0 commit comments