-- Free resources associated with the CLOB and Parser now they are no longer needed. dbms_lob.freetemporary(l_clob); dbms_xmlparser.freeParser(l_parser);

-- Get a list of all the nodes in the document using the XPATH syntax. l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'/employees');

-- Loop through the list and create a new record in a tble collection -- for each record. FOR cur_emp IN 0 .. dbms_xmldom.getLength(l_nl) - 1 LOOP

l_n := dbms_xmldom.item(l_nl, cur_emp);

-- Use XPATH syntax to assign values to he elements of the collection. dbms_xslprocessor.valueOf(l_n,'emp_id/text()',v_emp_id); dbms_xslprocessor.valueOf(l_n,'emp_name/text()',v_emp_name); dbms_xslprocessor.valueOf(l_n,'birthday/text()',v_birthday);

-- ----------------------------------------------------------------------- -- THE FOLLOWING BLOCK OF CODE WILL ATTEMPT TO INSERT / WRITE THE CONTENTS -- OF AN XML FILE TO A CLOB COLUMN. IN THIS CASE, WE WILL USE THE -- DBMS_LOB.LoadFromFile() API WHICH *DOES NOT* SUPPORT MULTI-BYTE -- CHARACTER SET DATA. -- -----------------------------------------------------------------------

-- ----------------------------------------------------------------------- -- THE FOLLOWING BLOCK OF CODE WILL ATTEMPT TO INSERT / WRITE THE CONTENTS -- OF AN XML FILE TO A CLOB COLUMN. IN THIS CASE, WE WILL USE THE NEW -- DBMS_LOB.LoadCLOBFromFile() API WHICH *DOES* SUPPORT MULTI-BYTE -- CHARACTER SET DATA. -- -----------------------------------------------------------------------