On Sun, Sep 7, 2008 at 2:56 PM, Antje <[EMAIL PROTECTED]> wrote:
> Thanks a lot to Gabor and Duncan!
>
> I didn't know that XPath is a standard. I'll give it a deeper look to better
> understand it.
>
> Oh, I guess I understand a bit more
>
> xpathApply(doc, "//val", function(n) xmlValue(n))
or ju
Thanks a lot to Gabor and Duncan!
I didn't know that XPath is a standard. I'll give it a deeper look to better
understand it.
Oh, I guess I understand a bit more
xpathApply(doc, "//val", function(n) xmlValue(n))
would search globally for all nodes named "val" and return its values :-)
So tha
On Sun, Sep 7, 2008 at 12:10 PM, Gabor Grothendieck
<[EMAIL PROTECTED]> wrote:
> In particular try this:
>
>> Lines <- '
> +
> +
> + 22
> + 45
> +
> +
> + 44
> + 11
> +
> +
> + '
>>
>> library(XML)
>> doc <- xmlTreeParse(Lines, asText = TRUE, trim = TRUE, useInternalNo
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi Antje
Well, the XML package gives you a variety of ways to parse
an XML document and manipulate it in R.
Perhaps the approach that best matches the Java-style you
outline is to use XPath to access nodes.
To do this, you use
doc = xmlTreeParse("fi
In particular try this:
> Lines <- '
+
+
+ 22
+ 45
+
+
+ 44
+ 11
+
+
+ '
>
> library(XML)
> doc <- xmlTreeParse(Lines, asText = TRUE, trim = TRUE, useInternalNodes =
> TRUE)
> root <- xmlRoot(doc)
>
> data1 <- getNodeSet(root, "//data")[[1]]
> xmlValue(getNodeSet(dat
On 7 September 2008 at 10:22, Antje wrote:
| I try to rewrite some Java-code with R. It deals with reading XML files. I
[...]
| Now, I'd like to do something like this in R. Most important would be to
| retrieve a node just by its name, not by the whole path. How is it possible?
|
| Can anybody
well not sure how its done in R , but heres a way to do it in simple Excel.
http://decisionstats.com/2008/parsing-xml-files-easily/
Parsing XML files easily
To parse a XML (or KML or PMML) file easily without using any
complicated softwares, here is a piece of code that fits right in your
excel s
Hi there,
I try to rewrite some Java-code with R. It deals with reading XML files. I
started with the XML package. In Java, I had a very useful method which gave me
a node by using:
name of the node
index of appearance
start point: global (false) / local (true)
So, I could do something like
8 matches
Mail list logo