I am reading XPath-Expressions from an XML-File using readLines
and xmlTreeParse
, xmlToList
from the XML
package.
In my XML file there is a line with an XPath like
//*[(@id = "name")] (1)
The functions mentioned above always add escape chars to my XPath which turns them to
"//*[(@id = \"name\")]" (2)
How can I convert (2) back to (1)?
I already tried:
stringi::stri_unescape_unicode
gsub
with "\" as pattern which leads to an "Trailing backslash" errorgsub
with "[\]" which changes nothing- some variations of the above using
intToUtf8()
- adding escape
\
to my XML file