r-lib / xml2

Bindings to libxml2
https://xml2.r-lib.org/
Other
220 stars 82 forks source link

Add a paramter to read a slice of the xml (row range or number of rows) #362

Closed abalter closed 1 year ago

abalter commented 2 years ago

I have a huge XML file. Can't read it all in at once.

Brief description of the problem

This hangs:

x = read_xml("file.xml")
l = as_list(x)

Feature request

x = read_xml("file.xml", n_records=1000)
y = read_xml("file.xml", slice=c(1000, 2034))
hadley commented 1 year ago

I think this sort of interface is useful for rectangular data, but unfortunately I just don't see how it would apply to XML.

abalter commented 1 year ago

It was a naive suggestion predicated by knowing that my particular data is a list of records. I think the idea was "can I ask to read a representative subset of the data". In theory, that is not a valid question to ask with unstructured data. But, in practice, it often is.