I am attempting to pull out the values for the topics attribute from an xml document in Oracle and I am not getting the topic values. I do, however, get the proper count for the number of "topics" attributes. I need to know how to make this code work. Can you please help?
/*
XML Code to parse
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--Arbortext, Inc., 1988-2007, v.4002-->
<!DOCTYPE doc PUBLIC "-//BCBSM//DTD Conversion of Legacy Benefit Documents 2//EN"
"S:\BI3\Software\DTDs\BC\Contractual\BI3 Benefit Document - 2002-06-25.dtd">
<doc>
<topics>
<topic id="T59992">Maximum co-payment</topic>
<topic id="T52618">Deductible</topic>
<topic id="T12018">Copayment</topic>
<topic id="T17382">Vaginal Delivery</topic>
</topics>
<para fbm="yes"><bold>BLUE CROSS AND BLUE SHIELD OF MICHIGAN</bold></para>
<sec1>
<header_text>INTER-OFFICE MEMO</header_text>
<para fbm="yes">TO: DISTRIBUTION</para>
<para fbm="yes">CODE:</para>
<para fbm="yes">SUBJECT: ST. JOSEPH MERCY HOSPITAL - PONTIAC</para>
<para fbm="yes">FROM: LYNN POWELL</para>
<para fbm="yes">CODE: J734</para>
<para fbm="yes">DATE: MARCH 30, 1993</para>
<sec2 topics="T17382 T12018 T52618">
<header_text>ALERT!!</header_text>
<para fbm="yes"><bold>ASC PLAN MODIFICATION 297</bold></para>
<para fbm="yes"><bold>FORM NUMBER 0099</bold></para>
<para fbm="yes"><bold>ST. JOSEPH MERCY HOSPITAL − PONTIAC</bold></para>
<para>Effective May 1, 1993, the deductible and copayment for<bold>PRE AND POST NATAL CARE</bold>will no longer be waived for members enrolled in Group Number 00285, Suffixes 000, 001, 002, 005 and 008.</para>
<para topics="T59992">BCBSM will subject these services to the group’s
annual deductible and copayment requirements, whether or not the care
is provided by an MHS provider or by any other physician. (The copayment
will be applied to the annual out-of-pocket maximum.)</para>
<para fbm="yes">Please place the memo with ASC Plan Modification 297
where it can be easily referenced.</para>
<para fbm="yes"><bold>SINCE THIS GROUP IS SELF-FUNDED UNDER AN ASC
ARRANGEMENT, A RIDER FOR THIS MODIFICATION WILL NOT BE FILED WITH
THE INSURANCE BUREAU.</bold></para>
</sec2>
</sec1>
</doc>
*/
l_parser := dbms_xmlparser.newParser;
dbms_xmlparser.setValidationMode(l_parser, FALSE);
dbms_xmlparser.setPreserveWhiteSpace(l_parser, TRUE);
-- l_file_content_clob contains the above XML
dbms_xmlparser.parseClob(l_parser, l_file_content_clob);
l_doc := dbms_xmlparser.getDocument(l_parser);
dbms_lob.freetemporary(l_file_content_clob);
dbms_xmlparser.freeParser(l_parser);
l_nl2 := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode (l_doc),'//@topics');
l_node_count2 := dbms_xmldom.getLength(l_nl2);
-- l_node_count2 is 2 which is the proper number
l_node_list2 := '';
l_node_count2 := 0;
FOR cur_topic IN 0 .. dbms_xmldom.getLength(l_nl2) - 1 LOOP
l_n := dbms_xmldom.item(l_nl2, cur_topic);
l_nmNodeMap := dbms_xmldom.getAttributes(l_n);
-- Find the topics attribute – for some reason the following code does not return the values of what I stuck in l_nl2
l_n2 := dbms_xmldom.getNamedItem(l_nmNodeMap,'topics');
aAttr := dbms_xmldom.makeAttr(l_n2);
l_node_list2 := l_node_list2 || dbms_xmldom.getValue(aAttr) || ' ';
l_node_count2 := l_node_count2 + 1;
END LOOP;