Example 5-9: The xmldoc helper package specification

CREATE OR REPLACE PACKAGE xmldoc AS

  -- Save an XML document (parsing it first if necessary) into the
  -- xml_documents table with a given document name.

  PROCEDURE save(name     VARCHAR2,
                 xmldoc   VARCHAR2,
                 docommit BOOLEAN := TRUE);
  PROCEDURE save(name     VARCHAR2,
                 xmldoc   CLOB,
                 docommit BOOLEAN := TRUE);
  PROCEDURE save(name VARCHAR2,
                 xmldoc BFILE,
                 docommit BOOLEAN := TRUE);
  PROCEDURE save(name VARCHAR2,
                 xmldoc xmldom.DOMDocument,
                 docommit BOOLEAN:=TRUE);

  -- Get an XML document by name from the xml_documents table

  FUNCTION  get(name VARCHAR2)       RETURN xmldom.DOMDocument;

  -- Get an XML document as a CLOB by name from the xml_documents table

  FUNCTION  getAsCLOB(name VARCHAR2) RETURN CLOB;

  -- Get an XML document as a VARCHAR2 by name from the xml_documents table

  FUNCTION  getAsText(name VARCHAR2) RETURN VARCHAR2;

  -- Remove an XML document by name from the xml_documents table

  PROCEDURE remove(name VARCHAR2, docommit BOOLEAN := TRUE);

  -- Test if a named document exists in the xml_documents table

  FUNCTION  docExists(name VARCHAR2) RETURN BOOLEAN;
END;