document: add a constructor to read metadata in the document body