Updated _OptionalElement to check for presence of attributes on a node before flagging it as empty