Gets a string from an attribute or node.