Re: [R] getNodeSet - what am I doing wrong?

2010-08-31 Thread Johannes Graumann
Sorry about that - got dropped from my attempts yesterday (see the first example below, that has the "useInternalNodes=TRUE") ... Thanks again, Joh Duncan Temple Lang wrote: > Johannes Graumann wrote: >> Thanks! >> but: >> > library(XML) >> > xmlDoc <- xmlTreeParse("http://www.unimod.org/xml/u

Re: [R] getNodeSet - what am I doing wrong?

2010-08-31 Thread Duncan Temple Lang
Johannes Graumann wrote: > Thanks! > but: > > library(XML) > > xmlDoc <- xmlTreeParse("http://www.unimod.org/xml/unimod_tables.xml";) You need to xmlParse() or xmlTreeParse(url, useInternalNodes = TRUE) (which are equivalent) in order to be able to use getNodeSet(). The error you are getting is b

Re: [R] getNodeSet - what am I doing wrong?

2010-08-31 Thread Johannes Graumann
Thanks! but: > library(XML) > xmlDoc <- xmlTreeParse("http://www.unimod.org/xml/unimod_tables.xml";) > getNodeSet(xmlDoc,"//x:modifications_row", "x") Error in function (classes, fdef, mtable) : unable to find an inherited method for function "saveXML", for signature "XMLDocument" ? Thanks,

Re: [R] getNodeSet - what am I doing wrong?

2010-08-30 Thread Duncan Temple Lang
Hi Johannes This is a common issue. The document has a default XML namespace, e.g. the root node is defined as http://www.unimod.org/xmlns/schema/unimod_tables_1";...> . So you need to specify which namespace to match in the XPath expression in getNodeSet(). The XML package provide

[R] getNodeSet - what am I doing wrong?

2010-08-30 Thread Johannes Graumann
Hi, Why is the following retuning a nodset of length 0: > library(XML) > test <- xmlTreeParse( > "http://www.unimod.org/xml/unimod_tables.xml",useInternalNodes=TRUE) > getNodeSet(test,"//modifications_row") Thanks for any hint. Joh __ R-help@r-projec