Clean up add_attributes function
Add some tests to check that tables are structured as intended

* Attribute table should be nil for elements with no attributes
* Length operator should return 0 for element nodes with no children