[xml] Unexpected Nodeset Limit for XPath



I have a large XML file, but a fairly basic and flat layout. Depending on the number of elements, I'm hitting a nodeset limit.

I'm surprised to hit the nodeset limit because it seems like the xpath can ignore (ie. not store) all of the "Term" elements--which are causing the error.

If I reduce the number of "Term" elements then it works fine.

libxml2 version 2.9.12

I can repro the issue with xmllint

Here's a basic XML to demonstrate the behavior (this example is stripped down for demonstration purposes, the XPath makes more sense in the real-world use case):


<?xml version="1.0" encoding="UTF-8"?>
<Elements id="5M_Elements">
    <Group>
        <Term>1</Term>
        <Term>2</Term>
        <Term>3</Term>
        <!-- 5 Million more Term elements... -->
    </Group>
</Elements>


Here's what I get for the XPath:

xmllint --xpath '//*[@id="5M_Elements"]' ./LibXml_NodeSetLimit.xml >/dev/null
XPath error : Memory allocation failed : growing nodeset hit limit

growing nodeset hit limit

^
XPath evaluation failure


Can the XPath code not count all of these elements toward the node limit?


Thanks,

Nick




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]