R xmltreeparse PCDATA错误

R xmltreeparse PCDATA error

I am pulling an xml file into R and extracting data from it. There is usually a "password" of random characters, usually non standard.

My code:

fileLoc <- file.choose()
print(paste("file: ", fileLoc))
dataSet <- xmlRoot(xmlInternalTreeParse(fileLoc))

The failure happens at xmlInternalTreeParse(fileLoc) where I get the error:

PCDATA invalid Char value 26
PCDATA invalid Char value 27
PCDATA invalid Char value 19

I know this is because of these non-standard characters, but is there anyway to have the parser handle these? Or to edit the xml file to remove them before calling xmlInternalTreeParse through R? If I manually remove them it works, but there can be thousands of these to go through so I would prefer to find another way.

Character examples:


Thank you for your time.