Example 5-13: Testing the xml_claim package

DECLARE
  claimdoc xmldom.DOMDocument;
BEGIN

  -- Store an XML Insurance Claim into ins_claim and ins_claim_payment
  -- tables directly from an external XML BFILE

  claimdoc := xml.parse(BFileName('XMLFILES','claim77805.xml'));
  xml_claim.store(claimdoc);
  xml.freeDocument(claimdoc);

  -- To show another technique, first store the external XML file in
  -- the xml_documents "staging" table...

  claimdoc := xml.parse(BFileName('XMLFILES','claim77804.xml'));
  xmldoc.save('claim77804',claimdoc);
  xml.freeDocument(claimdoc);

  -- ...Then store the XML insurance claim into ins_claim and
  -- ins_claim_payments by reading the XML from the staging table.

  claimdoc := xmldoc.get('claim77804');
  xml_claim.store(claimdoc);
  xml.freeDocument(claimdoc);

END;