code: public static void setUpExample(XMLDocumentManager docMgr, String docId, String filename) throws IOException {
      InputStream docStream = Util.openStream("data"+File.separator+filename);
      if (docStream == null)
        throw new IOException("Could not read document example");
  
      DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle();
      metadataHandle.getCollections().addAll("products", "real-estate");
      metadataHandle.getPermissions().add("app-user", Capability.UPDATE, Capability.READ);
      metadataHandle.getProperties().put("reviewed", true);
      metadataHandle.setQuality(1);
      metadataHandle.getMetadataValues().add("key1", "value1");
  
      InputStreamHandle handle = new InputStreamHandle();
      handle.set(docStream);
  
      docMgr.write(docId, metadataHandle, handle);
    }
docs: set up by writing document metadata and content for the example to read