Search notes:

ORA-31011: XML parsing failed

create table tq84_x(lpx number, c clob);

--
-- We have an ampersand in the insert statements…
-- … setting define off makes sure that this is not
-- interpreted as a variable.
--
set define off

begin
   delete from tq84_x;
  
   insert into tq84_x values (   7.1, '<a>'                     );
   insert into tq84_x values (   7.2, ' '                       );
   insert into tq84_x values ( 210.1, 'x'                       );
   insert into tq84_x values ( 225.1, '<a></b>'                 );
   insert into tq84_x values ( 229.1,  empty_clob()             );
   insert into tq84_x values ( 242.1, '<a>&</a>'                );
   insert into tq84_x values ( 243.1, '<a id=42/>'              );
   insert into tq84_x values ( 245.1, '<a></a>e'                );
   insert into tq84_x values ( 254.1, '<?xml version="1.0"><a/>'); -- Should be <?xml version="1.0"?>
  
   insert into tq84_x values (   0.0,  null                     );
end;
/
select xmltype(c) from tq84_x where lpx =    7.1;
-- ORA-31011: XML parsing failed
-- ORA-19202: error in XML processing
-- LPX-00007: unexpected end-of-file encountered
select xmltype(c) from tq84_x where lpx =    7.2;
-- ORA-31011: XML parsing failed
-- ORA-19202: error in XML processing
-- LPX-00007: unexpected end-of-file encountered
select xmltype(c) from tq84_x where lpx =  210.1;
-- ORA-31011: XML parsing failed
-- ORA-19213: error occurred in XML processing at lines 1
-- LPX-00210: expected '<' instead of 'x'
select xmltype(c) from tq84_x where lpx =  225.1;
-- ORA-31011: XML parsing failed
-- ORA-19213: error occurred in XML processing at lines 1
-- LPX-00225: end-element tag "b" does not match start-element tag "a"
select xmltype(c) from tq84_x where lpx =  229.1;
-- ORA-31011: XML parsing failed
-- ORA-19202: error in XML processing
-- LPX-00229: input source is empty
select xmltype(c) from tq84_x where lpx =  242.1;
-- ORA-31011: XML parsing failed
-- ORA-19213: error occurred in XML processing at lines 1
-- LPX-00242: invalid use of ampersand ('&') character (use &amp;)
select xmltype(c) from tq84_x where lpx =  243.1;
-- ORA-31011: XML parsing failed
-- ORA-19213: error occurred in XML processing at lines 1
-- LPX-00243: element attribute value must be enclosed in quotes
select xmltype(c) from tq84_x where lpx =  245.1;
-- ORA-31011: XML parsing failed
-- ORA-19213: error occurred in XML processing at lines 1
-- LPX-00245: extra data after end of document
select xmltype(c) from tq84_x where lpx =  254.1;
-- ORA-31011: XML parsing failed
-- ORA-19213: error occurred in XML processing at lines 1
-- LPX-00254: invalid XML declaration
drop table tq84_x;
select xmltype('') from dual;
-- ORA-19032: Expected XML tag , got no content
-- ORA-06512: at "SYS.XMLTYPE", line 310
-- ORA-06512: at line 1

See also

An instance of an XMLType cannot be created from a null value.
Other Oracle error messages

Index