R解析xml文件

library(XML)
# 解析XML文件
doc <- xmlParse('/home/xuefliang/Dropbox/xin.xml')
url <- unlist(getNodeSet(doc,"//enclosure/@url"),use.names = T)
title <- unlist(getNodeSet(doc,"//title/text()"),use.names = FALSE)
df <- data.frame(url)
write.csv(df,'/home/xuefliang/xin.csv')

library(xml2)
doc <- read_xml('/home/xuefliang/Downloads/xin.xml')
#xml_name(doc)
#xml_text(doc)
xml_find_all(doc, ".//enclosure/@url")[]

评论

此博客中的热门博文

V2ray websocket(ws)+tls+nginx分流

Rstudio 使用代理