Check first if document has content or not
Try parsing XML files into class "Document"