Dear All,
I have a very simple question to which I did not find any
answer online (apologize if it exists).
I have an XML file (attached) on which I just want
to modify the info of a node.
So, I load my xml file:
current = xmlTreeParse(file, useInternalNodes=T)
and I want to change the information of:
<filename>1.jpg</filename>
to be, for example: 1-1.jpg (newname)
I do:
xmlValue( xpathApply( current, "/annotation/filename")[[1]] ) = newname
now, the crazy thing is that it does the change to the xml
but it also through the following error:
Error in xmlValue(xpathApply(current, "/annotation/filename")[[1]]) =
newname : could not find function "xpathApply<-"
it seems that it works, but for a mysterious reason, it also
seems that it does not work.
Since I have to apply this change many times, and write
the resulting modified .xmls, the loop would stop as a
result of the error...
what am i missing here? is there any simpler way to do it?
thanks a lot for your kind help,
Moreno
P.S. I also try:
xmlSApply(xpathApply( current, "/annotation/filename")[[1]], xmlValue)
= newname
obtaining the same result.
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.