我有以下XML文件
<conf>
<Constraints>
<BETA>0</BETA>
</Constraints>
</conf>
当我尝试加载此xml
时R> library(XML)
R> xmlParse('test.xml')
*** caught segfault ***
address 0x3a00000000, cause 'memory not mapped'
Traceback:
1: .Call("RS_XML_ParseTree", as.character(file), handlers, as.logical(ignoreBlanks), as.logical(replaceEntities), as.logical(asText), as.logical(trim), as.logical(validate), as.logical(getDTD), as.logical(isURL), as.logical(addAttributeNamespaces), as.logical(useInternalNodes), as.
logical(isHTML), as.logical(isSchema), as.logical(fullNamespaceInfo), as.character(encoding), as.logical(useDotNames), xinclude, error, addFinalizer, as.integer(options), as.logical(parentFirst), PACKAGE = "XML")
2: xmlParse("test.xml")
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection:
在R?
中加载xml文件之前是否需要评估一些内容?xml文件在语法方面似乎是正确的(根据web xml验证器)
我创建了一个新文件并粘贴了几行并且它们崩溃了,所以它似乎不是文件格式...
R> sessionInfo()
R version 3.3.0 (2016-05-03)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS release 6.6 (Final)
locale:
[1] C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] XML_3.98-1.4
我尝试了xml2
R> library(xml2)
R> read_xml(
x= encoding= ...= as_html= options= n= verbose= base_url=
R> read_xml(x = 'test.xml')
*** caught segfault ***
address 0x3a00000000, cause 'memory not mapped'
Traceback:
1: .Call("xml2_doc_parse_file", PACKAGE = "xml2", path, encoding, as_html, options)
2: doc_parse_file(con, encoding = encoding, as_html = as_html, options = options)
3: read_xml.character(x = "test.xml")
4: read_xml(x = "test.xml")
我的想法是这些软件包使用的libXml2
库必须在这里出错...虽然我不知道如何测试这个
g++ -m64 -I/usr/include/R -DNDEBUG -I/usr/include/libxml2 -I/usr/local/include -I"/pxfs1/home/user/R/x86_64-redhat-linux-gnu-library/3.3/Rcpp/include" -I"/pxfs1/home/user/R/x86_64-redhat-linux-gnu-library/3.3/BH/include" -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c RcppExports.cpp -o RcppExports.o
我所拥有的libxml2已经过时了:
$ rpm -qa |grep -i libxml2
libxml2-2.7.6-17.el6_6.1.i686
libxml2-python-2.7.6-17.el6_6.1.x86_64
libxml2-devel-2.7.6-17.el6_6.1.i686
libxml2-2.7.6-17.el6_6.1.x86_64
libxml2-devel-2.7.6-17.el6_6.1.x86_64
答案 0 :(得分:0)
正在更新libxml2
libxml2-python-2.7.6-21.el6_8.1.x86_64 Fri 04 Nov 2016 10:10:17 AM EDT
libxml2-devel-2.7.6-21.el6_8.1.x86_64 Fri 04 Nov 2016 10:10:17 AM EDT
libxml2-devel-2.7.6-21.el6_8.1.i686 Fri 04 Nov 2016 10:10:16 AM EDT
libxml2-2.7.6-21.el6_8.1.x86_64 Fri 04 Nov 2016 10:10:16 AM EDT
libxml2-2.7.6-21.el6_8.1.i686 Fri 04 Nov 2016 10:10:16 AM EDT
答案 1 :(得分:0)
显然,R XML包中存在一个错误。我们发现,已经引入了一些新的方法来管理此程序包中的引用(错误发生在Linux / OS X,而不是Windows)
解决方法是在禁用节点GC的情况下安装此软件包
R -e 'install.packages("XML", configure.args=c("--enable-nodegc=no"))