I managed to parse more complex XML files as well. The trick was to
manually determine the position of the child nodes of interest, after
which they can be parsed in a loop. For example:
require(XML)
doc - xmlTreeParse(file.xml,getDTD=T,addAttributeNamespaces=T)
r - xmlRoot(doc)
#find the nodes
bogdan romocea br44114 at yahoo.com writes:
:
: Dear useRs,
:
: I have a simple/RTFM question about XML parsing. Given an XML file,
: such as (fragment)
: A100/A
: B23/B
: Ctrue/C
: how do I import it in a data frame or list, so that the values (100,
: 23, true) can be accessed through the
Gabor Grothendieck wrote:
You could check out the ctv package that was recently announced.
It uses XML so its source would provide an example.
If its a one-time operation, Excel reads XML and you could then
use one of the many Excel to R possibilities.
For an xml file like this:
?xml version=1.0?
Dear useRs,
I have a simple/RTFM question about XML parsing. Given an XML file,
such as (fragment)
A100/A
B23/B
Ctrue/C
how do I import it in a data frame or list, so that the values (100,
23, true) can be accessed through the names A, B and C?
I installed the XML package and looked over the