What is difference between elements and attributes in XML?

Elements are used to encapsulate pieces of data, and attributes are generally used to provide accompanying information about an element, rather than to encapsulate raw data itself.