xml2 icon indicating copy to clipboard operation
xml2 copied to clipboard

Huge String problem

Open amalagoli opened this issue 2 years ago • 1 comments

I have an XML response from a Web Api query that returns a very large string text in one node. When I try to apply read_xml(response$content) I get a warning about a 'huge string nod', and the parsing fails.

This is a known issue with libxml, I guess. I have no easy way to send a reproducible example since the Api is proprietary. There seems to be some internal memory limit which is hardcoded, but can be relaxed.

Is there a setting in read_xml to enable the reading of huge strings?

# insert reprex here

amalagoli avatar May 06 '22 13:05 amalagoli

I am having a similar issue where I am getting the following error from read_xml:

"Error in read_xml.raw(content, encoding = encoding, base_url = if (nzchar(base_url)) base_url else x$url, : internal error: Huge input lookup [1]"

I tried the following to (presumably) set the XML_PARSE_HUGE flag for xmlReadMemory, but still receive the same error.

xml2::read_xml(x, encoding = "utf-8", options = list("NOBLANKS", "HUGE"))

where x is an httr response that is 12.2MB.

JasonCurole avatar Sep 14 '22 14:09 JasonCurole

Unfortunately I don't think there's much we can do here, sorry.

hadley avatar Oct 30 '23 18:10 hadley