Bug #26870 1512 Incorrect XML value: 'parse error at line 172 pos 26: To deep XML'
Submitted: 6 Mar 2007 10:52 Modified: 16 Sep 2015 10:45
Reporter: Chen Li Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: XML functions Severity:S2 (Serious)
Version:5.1 OS:Linux (Linux, Windows)
Assigned to: Assigned Account CPU Architecture:Any
Tags: 1512, deep XML, file size limitation, Incorrect XML value, parse error, To deep XML

[6 Mar 2007 10:52] Chen Li
Description:
I put some big XML files(>2MB) into MySQL 5.1 and stored them as mediumtext.

When I perform even very basic XPath query, I get the warning message: "1512 Incorrect XML value: 'parse error at line 172 pos 26: To deep XML'". And the query result set was always empty.

How to repeat:
1. Store big XML files(>2MB) into mediumtext of MySQL 5.1
2. Run whatever XPath query.
3. You will get "1512 Incorrect XML value: 'parse error at line 172 pos 26: To deep XML'" and result set is empty.

Suggested fix:
Please check if there is any file size limitation or memory out problem when perform xpath query.
[6 Mar 2007 11:38] Sveta Smirnova
Thank you for the report.

I can not repeat the issue with test data.

Please provide broken XML file and query you use.
[6 Mar 2007 13:09] Chen Li
I put the example file in ftp://ftp.mysql.com/pub/mysql/upload/, the file name is bigModel.xml.

1st step: CREATE TABLE `test` (`id` int NOT NULL default 0,
  `file` mediumtext,
  PRIMARY KEY  (`id`)
)
2nd step: append a new record which `id`=1 into table `test` and put the bigModel.xml into field `file`.
3rd step: SELECT ExtractValue((SELECT file FROM test WHERE id=1), 'count(sbml)')
Then you will get "1512 Incorrect XML value: 'parse error at line 172 pos 26: To deep XML'" and empty result set.

Thank you.
[6 Mar 2007 20:06] Sveta Smirnova
Thank you for the report.

Verified as described.
[6 Mar 2007 20:07] Sveta Smirnova
create database, place xml file to directory with test and run

Attachment: bug26870.php (application/octet-stream, text), 636 bytes.

[14 Mar 2007 20:08] Jeremy Volkman
We ran into this same problem using UpdateXML.  However, our mediumtext blob was far less sizable at only about 50000 bytes.
[9 Oct 2007 9:42] Alexander Barkov
A simple query demonstrating the same problem:

mysql> select ExtractValue(concat('<root>', repeat('<a>',100), 'a', repeat('</a>',100),'</root>'),'//a');
+--------------------------------------------------------------------------------------------+
| ExtractValue(concat('<root>', repeat('<a>',100), 'a', repeat('</a>',100),'</root>'),'//a') |
+--------------------------------------------------------------------------------------------+
|                                                                                            |
+--------------------------------------------------------------------------------------------+
1 row in set, 1 warning (0.00 sec)

mysql> show warnings;
+---------+------+-------------------------------------------------------------------+
| Level   | Code | Message                                                           |
+---------+------+-------------------------------------------------------------------+
| Warning | 1513 | Incorrect XML value: 'parse error at line 1 pos 195: To deep XML' |
+---------+------+-------------------------------------------------------------------+
1 row in set (0.00 sec)

With no-so-deep XML value it works fine:

mysql> select ExtractValue(concat('<root>', repeat('<a>',10), 'a', repeat('</a>',10),'</root>'),'//a');
+------------------------------------------------------------------------------------------+
| ExtractValue(concat('<root>', repeat('<a>',10), 'a', repeat('</a>',10),'</root>'),'//a') |
+------------------------------------------------------------------------------------------+
| a                                                                                        |
+------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
[14 May 2008 18:35] Brto d Sra
Having basically the same here. Only the error code I get is:
Incorrect XML value: 'parse error at line 1738 pos 45: '</add_transaction_>' unexpected ('</add_transaction_id>' wanted)'

The XML line is actually ok as verified manually.
[15 Jun 2009 19:44] Brad Balmer
Is there a patch for this issue or are we going to have to wait until the 6.x release for this to be fixed?
[15 Jun 2009 22:26] Jon Stephens
'Verified' means that we've confirmed that the bug exists. Since this bug has never been 'In Progress' or in any status containing the word 'patch', you may assume that no fixes have yet been done.

I have no information regarding plans for a fix other than that this bug was tagged to be fixed in MySQL 6.0.

I don't understand why a fix was postponed to 6.0 in the first place. Since we won't be doing any further work on 6.0, I'm resetting the bug's status to 'Open' and requesting that it be reassessed and a fix targeted for MySQL 5.1, or -- failing that -- for the next release series to follow MySQL 5.1, and an explanation as to why we can't or won't fix it in 5.1.
[9 Mar 2010 18:53] Muhammad Kashif
We are facing the same problem i.e "Incorrect XML value: 'parse error at line 184 pos 29: To deep XML'"

Our xml file is only 6 kb in size. The error generates when the parser try to parse element at 11th Level.

Is the problem resolved?
Any suggestion, work arounds.
[26 Apr 2010 15:07] Brian Downey
We too are having a problem, our XML is only 6KB in size, and is dying on parsing an element only 6 deep.

According to the error, it is dying on this line in our XML:

 <footnoteId id="F1"/>

Which it too is only six deep.  To me it almost seems like it's having trouble with the stand-alone element tag (< />)

Are there any updates on this bug?  It seems somewhat depressing it has been open since March 2007 (3 years) without a resolution.
[2 May 2011 16:38] Chompion Jones
Experiencing the same issue on 5.5.9 (x64).

Is there a resolution in sight?
[28 Jul 2011 23:06] Alessandro Vernet
This can be reproduced very simply with:

set @xml = '<lorem-ipsum-dolor-sit-amet>
    <lorem-ipsum-dolor-sit-amet>
        <lorem-ipsum-dolor-sit-amet>
            <lorem-ipsum-dolor-sit-amet>
                <lorem-ipsum-dolor-sit-amet/>
            </lorem-ipsum-dolor-sit-amet>
        </lorem-ipsum-dolor-sit-amet>
    </lorem-ipsum-dolor-sit-amet>
</lorem-ipsum-dolor-sit-amet>';
select extractvalue(@xml, '42');
show warnings;
[2 Jun 2014 11:11] joseph jobbings
This bug strikes me as very limiting of the XML function.  Is this bug scheduled for a fix in a forthcoming release?
[9 Jul 2014 11:35] Holger Lausen
Is there really no fix or workaround for this? 

What is really strange that it seems even to depend on the length of an attribute name, query 1 does not work query 2 does work...

SELECT ExtractValue('<HotelDescriptiveContent>
  <FacilityInfo><GuestRooms><GuestRoom>
        <MultimediaDescriptions><MultimediaDescription>
            <TextItem  a123456789012345="1" >aa</TextItem>
          </MultimediaDescription></MultimediaDescriptions>
      </GuestRoom></GuestRooms></FacilityInfo>
</HotelDescriptiveContent>','//TextItem')  AS result;

SELECT ExtractValue('<HotelDescriptiveContent>
  <FacilityInfo><GuestRooms><GuestRoom>
        <MultimediaDescriptions><MultimediaDescription>
            <TextItem  a12345678901234="1" >aa</TextItem>
          </MultimediaDescription></MultimediaDescriptions>
      </GuestRoom></GuestRooms></FacilityInfo>
</HotelDescriptiveContent>','//TextItem')  AS result;
[14 Sep 2015 19:57] Mike Davies
Very disappointed that such an old bug still remains open with no fix target.  What is the point of including XML capabilities in the product with such a vicious limitation?
[16 Sep 2015 10:35] Jon Stephens
Holger,

Both your queries work for me with a recent 5.6 build.
[16 Sep 2015 10:45] Jon Stephens
All,

I've tested most of the alleged problem queries here, and found all of them that I tested work without error on a recent 5.6 build. I did not bother testing with 5.5 or earlier.

I believe this issue has been fixed elsewhere, so I'm closing this bug. (Possibly fixed by BUG#62429?)

If you can reproduce a similar problem in a recent release of 5.6, please file a new bug report.

Thanks!