I have would like to read XML 860 files.
All xml files have the structure
<ip id_pac="48">
<rodcis>48</rodcis>
<jmeno>Andrew</jmeno>
<prijmeni>Mazal</prijmeni>
<titul_pred></titul_pred>
<titul_za></titul_za>
<dat_dn format="D">1999-06-21</dat_dn>
<dat_de format="D"></dat_de>
<sex>M</sex>
<rod_prijm></rod_prijm>
<a typ="1">
<dat_od format="D">2020-09-17</dat_od>
</a>
</ip>
And I would like to get data frame where one column is "rodcis" (in this case 48) and second column "dat_od" (in this case 2020-09-17)
I am trying this
- Get all XML files
files <- list.files(path = "~/Downloads/XML",
pattern = "*.xml",
full.names = TRUE)
- Get a list (out) with all 860 XML files to
out <- lapply(files, xmlParse)
- List to dataframe
dataframe <- do.call(rbind, lapply(out, function(x) rootnode[[1]][[2]], rootnode[[2]][[1]]))
But an error occurs that I don't understand.
cannot coerce type 'externalptr' to vector of type 'list'