The hasAttributes() method returns TRUE if the current element node has any attributes, and FALSE otherwise.
The following code fragment loads "books.xml" into xmlDoc using loadXMLDoc() and checks if the first <book> element has any attributes:
Output: