Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

LPX-00601: Invalid token in: err while trying to read data from xml

yair_kOct 13 2010 — edited Nov 10 2010
Hey ,
While trying to read data from xml i got err:
LPX-00601: Invalid token in: 'path'

the proc. i'm using to read data from the xml is:

procedure read_xml_file_test (in_filename in varchar2)
is
my_dir  varchar2(20) := 'XML_DIR;
  cur_emp2 number:=0;
  l_bfile   BFILE;
  l_clob    CLOB;
  l_parser  dbms_xmlparser.Parser;
  l_doc     dbms_xmldom.DOMDocument;
  l_nl      dbms_xmldom.DOMNodeList; 
  l_nl2    dbms_xmldom.DOMNodeList; 
  l_n       dbms_xmldom.DOMNode;  
  l_n2     dbms_xmldom.DOMNode;
  l_temp    VARCHAR2(1000); 
v_errors        internet_clients.errors%type;  
src_csid       NUMBER := NLS_CHARSET_ID('UTF8');  
dest_offset    INTEGER := 1;
src_offset     INTEGER := 1;
lang_context   INTEGER := dbms_lob.default_lang_ctx;
warning        INTEGER;
v_count       number := 0;   --total records
v_count_s      number := 0;   -- sucsess record 
v_count_f      number := 0;   -- failed record
v_flag varchar2(1); 
v_char2 varchar2(1);
v_l1 VARCHAR2(255);
v_l2 VARCHAR2(255);
v_l3 VARCHAR2(255);
v_l4 VARCHAR2(255);
v_l6 VARCHAR2(255);

BEGIN
  l_bfile := BFileName(my_dir, in_filename);

  dbms_lob.createtemporary(l_clob, cache=>FALSE);
  dbms_lob.open(l_bfile, dbms_lob.lob_readonly);
  dbms_lob.loadclobfromfile(l_clob, l_bfile, dbms_lob.getlength(l_bfile), dest_offset,src_offset, src_csid, lang_context, warning);                         
  dbms_lob.close(l_bfile);
  -- make sure implicit date conversions are performed correctly
  dbms_session.set_nls('NLS_DATE_FORMAT','''DD/MM/RR HH24:MI:SS''');    
  -- Create a parser.
  l_parser := dbms_xmlparser.newParser;
  -- Parse the document and create a new DOM document.
    dbms_xmlparser.parseClob(l_parser, l_clob);
    l_doc := dbms_xmlparser.getDocument(l_parser); 
  -- 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),'soap:Envelope/soap:Body/GetFieldsNameResponse/GetFieldsNameResult/diffgr:diffgram/DataSet_FRM_GANERIC_PROP/FRM_GANERIC_PROP');
   
  -- 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); 

   cur_emp2:=0;
  
   loop
     v_count := v_count + 1;
     begin

    -- Use XPATH syntax to assign values to he elements of the collection.
    dbms_xslprocessor.valueOf(l_n,'L1/text()',v_l1);
    dbms_xslprocessor.valueOf(l_n,'L2/text()',v_l2);
    dbms_xslprocessor.valueOf(l_n,'L3/text()',v_l3);
    dbms_xslprocessor.valueOf(l_n,'L4/text()',v_l4);
    dbms_xslprocessor.valueOf(l_n,'L6/text()',v_l6);

        exception
  when others then  
  null;
  end;
     
 exit when cur_emp2=dbms_xmldom.getLength(l_nl2);
  END LOOP;
  end loop;
  -- Free any resources associated with the document now it
  -- is no longer needed.
  dbms_xmldom.freeDocument(l_doc); 
  
  --remove file to another directory    
	 --COMMIT;  -- do not use the commit if you want to run this proc. from within the search_dir_list proc , because it execute a select from tmp table dir_list which contain a "on commit delete rows"  clause.     
  /*EXCEPTION
  /*WHEN OTHERS THEN
   dbms_lob.freetemporary(l_clob);
    dbms_xmlparser.freeParser(l_parser);
   dbms_xmldom.freeDocument(l_doc); 
    null;
    ROLLBACK; */
END;
While trying to execute this i got:

ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00601: Invalid token in: 'soap:Envelope/soap:Body/GetFieldsNameResponse/GetFieldsNameResult/diffgr:diffgram/DataSet_FRM_GANERIC_PROP/FRM_GANERIC_PROP'
ORA-06512: at "XDB.DBMS_XSLPROCESSOR", line 939
ORA-06512: at "XDB.DBMS_XSLPROCESSOR", line 967
ORA-06512: at "MARKET.READ_XML_FILE_TEST", line 51
ORA-06512: at line 1

i guess i mised somthing at the line

l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'soap:Envelope/soap:Body/GetFieldsNameResponse/GetFieldsNameResult/diffgr:diffgram/DataSet_FRM_GANERIC_PROP/FRM_GANERIC_PROP');
i attached here part of my xml:

<?xml version="1.0" encoding="UTF-8" ?> 
- <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <soap:Body>
- <GetFieldsNameResponse xmlns="http://tempuri.org/">
- <GetFieldsNameResult>
- <xs:schema id="DataSet_FRM_GANERIC_PROP" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xs:element name="DataSet_FRM_GANERIC_PROP" msdata:IsDataSet="true" msdata:Locale="he-IL">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="FRM_GANERIC_PROP">
- <xs:complexType>
- <xs:sequence> 

  </xs:sequence>
  </xs:complexType>
  </xs:element>
  </xs:choice>
  </xs:complexType>
  </xs:element>
  </xs:schema>
- <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
- <DataSet_FRM_GANERIC_PROP xmlns="">
- <FRM_GANERIC_PROP diffgr:id="FRM_GANERIC_PROP1" msdata:rowOrder="0">
  <L1>val1</L1> 
  <L2>val2</L2> 
  <L3>val3</L3> 
  <L4>val4</L4> 
  <L6>val6</L6> 
  </FRM_GANERIC_PROP>
  </DataSet_FRM_GANERIC_PROP>
  </diffgr:diffgram>
  </GetFieldsNameResult>
  </GetFieldsNameResponse>
  </soap:Body>
  </soap:Envelope>
I Guess it somthing that have to do with node definition ,
but i have tried so many combinations and none ot those worked for me.
i'm deeply stuck here.

What do i miss here?

THANKS yair

Edited by: yair_k on 02:30 14/10/2010
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 8 2010
Added on Oct 13 2010
13 comments
7,850 views