Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 未知IO错误无法加载外部实体_R_Xml - Fatal编程技术网

R 未知IO错误无法加载外部实体

R 未知IO错误无法加载外部实体,r,xml,R,Xml,我正在努力学习R中的文本挖掘 我不知道为什么会出现这个错误 library(XML) xml.url <- "http://www.w3schools.com/xml/plant_catalog.xml" plants <- xmlParse(xml.url) plants.l <- xmlToList(plants) length(plants.l) 库(XML) xml.url您带来了一个xml包的问题。它不适合重定向(http->https,URL以http开头)和ht

我正在努力学习R中的文本挖掘

我不知道为什么会出现这个错误

library(XML)
xml.url <- "http://www.w3schools.com/xml/plant_catalog.xml"
plants <- xmlParse(xml.url)
plants.l <- xmlToList(plants)
length(plants.l)
库(XML)

xml.url您带来了一个
xml
包的问题。它不适合重定向(
http->https
,URL以
http
开头)和
https

您可以使用其他软件包下载该文件。下面是一个使用
httr
的示例

library(XML)
library(httr)
xml.url <- "http://www.w3schools.com/xml/plant_catalog.xml"
plants <- xmlParse(rawToChar(GET(xml.url)$content))
plants.l <- t(xmlToList(plants, simplify = TRUE))
length(plants.l)
库(XML)
图书馆(httr)

xml.url您带来了一个
xml
包的问题。它不适合重定向(
http->https
,URL以
http
开头)和
https

您可以使用其他软件包下载该文件。下面是一个使用
httr
的示例

library(XML)
library(httr)
xml.url <- "http://www.w3schools.com/xml/plant_catalog.xml"
plants <- xmlParse(rawToChar(GET(xml.url)$content))
plants.l <- t(xmlToList(plants, simplify = TRUE))
length(plants.l)
库(XML)
图书馆(httr)

xml.url必须将asText=TRUE添加到函数中。但是,它不喜欢网站的XML格式。可能的重复项必须在函数中添加asText=TRUE。但是,它不喜欢网站的XML格式。可能重复