Document contains too many nodes error when extracting xml tag name
858716Jun 22 2011 — edited Jun 23 2011I Have a large xml file in which the tag contains ~: as the value.
Now I am trying to extract all the tags which have ~: as the value and store that column using the following query and insert into a table.
insert into space_md select distinct xmltype(extract(value(x), '/').getstringval()).getrootelement() COLUMN_NAME
from gt_xmltype_tab gt, TABLE(XMLSequence(extract(gt.xmlfile1, '/ROWSET/ROW/*'))) x
where instr(extract(value(x),'/').getstringval(),'~:') > 1;
The xml file was generated using dbms_xmlgen.getxml. Table has 48 columns and around 4000 rows.
My above insert query gave me an error of 31186 too many nodes error.
I am using oracle version 10.2.0.3.
Following are the set of commands I ran....
SQL> insert into gt_xmltype_tab(xmlfile1)
values(XMLType(bfilename('BKUP_RES','QC.xml'),nls_charset_id('AL32UTF8'))); 2
1 row created.
SQL> SQL>
SQL> insert into restore_space_metadata select distinct 'QC', xmltype(extract(value(x), '/').getstringval()).getrootelement() COLUMN_NAME
2 from gt_xmltype_tab gt, TABLE(XMLSequence(extract(gt.xmlfile1, '/ROWSET/ROW/*'))) x
3 where instr(extract(value(x),'/').getstringval(),'~:') > 1;
insert into restore_space_metadata select distinct 'QC', xmltype(extract(value(x), '/').getstringval()).getrootelement() COLUMN_NAME
*
ERROR at line 1:
ORA-31186: Document contains too many nodes
Is there a better way of extracting the xml tag element name based on the xmltag content?
There is one other table which has 172 columns but only 100 rows so it doesnt create any problem on that table.
But this QC table has less columns but many many rows...
Any suggestions