Forum Stats

  • 3,839,390 Users
  • 2,262,486 Discussions
  • 7,900,957 Comments

Discussions

Error when loading XML into table

Hi everyone!

I'm having some trouble to load a XML in a table column, i've already loaded about 7 files, but one is displayng this error:

Erro a partir da linha : 1 no comando -

BEGIN load_xml(p_dir => 'XML_DIR', p_filename => 'CADASTRO_MENSAL_12018.xml'); END;

Relatório de erros -

ORA-31061: XDB error: XML event error

ORA-19202: Error occurred in XML processing

In line 65 of orastream:

LPX-00225: end-element tag "Endereco" does not match start-element tag "gen:Cidade"

ORA-06512: at "ESTUDO.LOAD_XML", line 28

ORA-06512: at line 1

31061. 00000 -  "XDB error: %s"

*Cause:    The specified error occurred in XDB.

*Action:   Correct the error or contact Oracle Support Services.

This occurs only with this file, I'm using the procedure:

CREATE OR REPLACE PROCEDURE load_xml (p_dir IN VARCHAR2,

  p_filename IN VARCHAR2) AS

  l_bfile BFILE := BFILENAME(p_dir, p_filename);

  l_clob CLOB;

  l_dest_offset INTEGER := 1;

  l_src_offset INTEGER := 1;

  l_bfile_csid NUMBER := 0;

  l_lang_context INTEGER := 0;

  l_warning INTEGER := 0;

BEGIN

  DBMS_LOB.createtemporary (l_clob, TRUE);

 

  DBMS_LOB.fileopen(l_bfile, DBMS_LOB.file_readonly);

  -- loadfromfile deprecated.

  -- DBMS_LOB.loadfromfile(l_clob, l_bfile, DBMS_LOB.getlength(l_bfile));

  DBMS_LOB.loadclobfromfile (

  dest_lob => l_clob,

  src_bfile => l_bfile,

  amount => DBMS_LOB.lobmaxsize,

  dest_offset => l_dest_offset,

  src_offset => l_src_offset,

  bfile_csid => l_bfile_csid ,

  lang_context => l_lang_context,

  warning => l_warning);

  DBMS_LOB.fileclose(l_bfile);

  INSERT INTO xml_tab (

  id,

  filename,

  xml

  )

  VALUES (

  xml_tab_seq.NEXTVAL,

  p_filename,

  XMLTYPE.createXML(l_clob)

  );

  COMMIT;

 

  DBMS_LOB.freetemporary (l_clob);

END;

/

Already checked the syntax of the XML by myself and with the XML Tools plugin of Notepad++ and it's ok, but when i try to load it says that the tags doesn't match, can anybody help me please?

Win7

Oracle 11g XE

Sql Developer 18.1

Tagged:
This discussion has been closed.