[R] XML - ampersand escaped

Ido M. Tamir tamir at imp.univie.ac.at
Thu Dec 3 15:20:47 CET 2009


Hi,
I create some DOM with XML and would like to include
∩ in the text of an element. The library automatically
escapses it to ∩.
unescaping \\∩ does not help.

any ideas?
My current plan is to go through the output and replace it
with gsub, but maybe there is a better way?

thanks,
ido

> library("XML")
> xml <- xmlTree("tree")
Warning message:
In xmlRoot.XMLInternalDocument(currentNodes[[1]]) : empty XML document
> xml$addNode("test","a ∩ b")
> xml$addNode("test","a \\∩ b")
>
>
> xml$value()
<?xml version="1.0"?>
<tree>
  <test>a &cap; b</test>
  <test>a \&cap; b</test>
</tree>




More information about the R-help mailing list