/**
   * This method retrieves an xml document from the database based on its resource identifier. The
   * document is returned as a string represnetation of its xml content.
   *
   * @param collection The name of the collection to look for the document.
   * @param resourceId The resource identifier of the document to be retrieved.
   * @param username The identifier of the user calling the method used for authentication.
   * @param password The password of the user calling the method used for authentication.
   * @return The xml document retrieved as a String.
   */
  public String retrieveDocumentAsXmlString(
      String collection, String resourceId, String username, String password) {
    String res = null;

    res =
        InputOutputHandler.parseDOMAsXMLString(
            this.retrieveDocument(collection, resourceId, username, password));

    return res;
  }
  /**
   * This method stores an xml document given as a String to the database giving it an indentifier.
   * If the identifier provided is null, then the database generates a unique identifier on its own.
   *
   * @param doc The String representation of the document to be stored.
   * @param resourceId The resourceId to give to the document as a unique identifier within the
   *     database. If null a unique identifier is automatically generated.
   * @param collection The name of the collection to store the document under. If it does not exist,
   *     it is created.
   * @param username The identifier of the user calling the method used for authentication.
   * @param password The password of the user calling the method used for authentication.
   */
  public void storeXmlStringDocument(
      String doc, String resourceId, String collection, String username, String password) {

    Document dom = InputOutputHandler.parseXMLStringAsDOM(doc);
    this.storeDomDocument(dom, resourceId, collection, username, password);
  }