Skip to content
Prev 44471 / 63421 Next

xmlParseDoc parser errors

On 11/16/12 6:10 AM, bryan rasmussen wrote:
That particular error message is most commonly associated with trying
to treat the first argument (the file name) as the XML content itself
because the file does not actually exist.
When you are not reading from XML content as an existing character vector,
you can use asText = FALSE in the call to xmlParseDoc() or xmlParse()
to avoid the function attempting to treat the file name as content,
e.g.
     xmlParseDoc("~/pis.xml", asText = FALSE)

Then you would get a message such

    I/O warning : failed to load external entity "/Users/duncan/pis.xml"
Firstly, xmlParseDoc() _will_ parse a processing instruction. The error is
not due to its presence.

You will get a warning because the target of the processing instruction contains the
string xml. Since you are using xmlParseDoc(), you can specify that parser should not
emit warnings via

  xmlParse("filename", NOWARNING)
Yes, it just works.  I believe that somehow you didn't have the file initially
and by editing it you caused it to be available.