1 Reply Latest reply on Jun 9, 2008 10:26 PM by Jason_(A_Non)

    ORA-20100: Error occurred while parsing: Expected name instead of =.,

    644058
      Hi,
      I have written a procedure and calling it from a workflow.I trying to parse the XML CLOB as parameter. I am getting the above error while parsing the CLOB.
      my CLOB is

      <?xml version="1.0" encoding="ASCII"?><first="1"><second>a</second><third>aa</third><second>b</second><third>bb</third><second>c</second><third>cc</third></first>

      I have written follwoing code
      PROCEDURE populate_req_interface (
      itemtype IN VARCHAR2,
      itemkey IN VARCHAR2,
      activity_id IN NUMBER,
      command IN VARCHAR2,
      resultout IN OUT VARCHAR2
      )
      IS
      l_po_number VARCHAR2 (10);
      l_rcv_group_id NUMBER := 0;
      l_error_loc NUMBER;
      l_error_msg VARCHAR2 (100);
      l_receipt_date DATE;
      l_event_data wf_event_t;
      l_xml_data CLOB;
      l_xml_parser xmlparser.parser;
      l_first_node_list xmldom.domnodelist;
      l_second_node_list xmldom.domnodelist;
      l_third_node_list xmldom.domnodelist;
      l_doc xmldom.domdocument;
      l_length NUMBER;
      l_node xmldom.domnode;
      l_first_num NUMBER;
      l_second_txt VARCHAR2 (15);
      l_third_txt VARCHAR2 (15);
      l_trx_error BOOLEAN := FALSE;

      CURSOR c_po_data
      IS
      SELECT FIRST
      FROM test1;
      BEGIN
      --Read all PO details
      --Existing PO Line id
      CASE command
      WHEN 'RUN'
      THEN
      l_error_loc := 10;
      l_event_data :=
      wf_engine.getitemattrevent (itemtype => itemtype,
      itemkey => itemkey,
      NAME => 'INFRAXML'
      );
      l_error_loc := 20;
      l_xml_data := l_event_data.event_data;
      --Parse Event Data
      l_error_loc := 30;

      insert into xml_test values(l_xml_data);
      commit;
      l_error_loc := 300;
      select result
      into l_xml_data
      from xml_test;
      delete from xml_test;
      commit;
      l_error_loc := 3001;
      l_xml_parser := xmlparser.newparser;
      l_error_loc := 301;

      -- xmlparser.parseclob (l_xml_parser, l_xml_data);
      xmlparser.parseBuffer(l_xml_parser,l_xml_data);

      l_error_loc := 302;

      l_doc := xmlparser.getdocument (l_xml_parser);
      l_error_loc := 40;

      --Fetch Node data into variables
      l_first_node_list :=
      xmldom.getelementsbytagname (l_doc, 'first');
      l_error_loc := 50;
      l_second_node_list :=
      xmldom.getelementsbytagname (l_doc, 'second');
      l_third_node_list :=
      xmldom.getelementsbytagname (l_doc, 'third');
      l_length := xmldom.getlength (l_first_node_list);
      l_error_loc := 60;

      FOR l_counter IN 0 .. l_length - 1
      LOOP
      l_error_loc := 70;
      l_node := xmldom.item (l_first_node_list, l_counter);
      l_node := xmldom.getfirstchild (l_node);

      IF xmldom.getnodetype (l_node) = xmldom.text_node
      THEN
      l_first_num := xmldom.getnodevalue (l_node);
      END IF;

      l_error_loc := 80;
      l_node := xmldom.item (l_second_node_list, l_counter);
      l_node := xmldom.getfirstchild (l_node);

      IF xmldom.getnodetype (l_node) = xmldom.text_node
      THEN
      l_second_txt :=
      TO_NUMBER (xmldom.getnodevalue (l_node));
      END IF;

      l_node := xmldom.item (l_third_node_list, l_counter);
      l_node := xmldom.getfirstchild (l_node);

      IF xmldom.getnodetype (l_node) = xmldom.text_node
      THEN
      l_third_txt :=
      TO_NUMBER (xmldom.getnodevalue (l_node));
      END IF;

      l_error_loc := 80;

      INSERT INTO test2
      (FIRST,second,third
      )
      VALUES (l_first_num,l_second_txt,l_third_txt
      );

      UPDATE test3
      SET second = l_first_num
      where first = l_first_num;
      END LOOP;

      IF l_trx_error
      THEN
      resultout := wf_engine.eng_completed || ':F';
      ELSE
      resultout := wf_engine.eng_completed || ':T';
      END IF;
      WHEN 'CANCEL'
      THEN
      resultout := wf_engine.eng_completed || ':T';
      ELSE
      resultout := '';
      END CASE;
      EXCEPTION
      WHEN OTHERS
      THEN
      wf_core.CONTEXT ('kpo_infracalloracle_pkg',
      'populate_req_interface',
      itemtype,
      itemkey,
      TO_CHAR (activity_id),
      TO_CHAR (l_error_loc),
      l_error_msg,
      SQLERRM,
      TO_CHAR (SQLCODE)
      );
      xmlparser.freeParser(l_xml_parser);

      RAISE;
      END populate_req_interface;

      Can anyone suggest something to comeout of this problem.
      Thanks in advance.

      Regards
      Vijay