0
时,我有以下XML文件[R段错误读取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文件(根据网页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
是的编译XML包的后端?你的xml文件有多大?我首先想到的问题是使用另一个XML库。 – snaut
对不起,我错过了你也发布了整个xml文件。 segfault是编译函数失败的提示。两个失败的函数都会在内部调用编译函数。确保你所有的软件包都是最新的版本和适合你的R安装的版本。请张贴包和R版本。 – snaut
对不起,很显然我今天不是很集中,我希望其他人更有帮助。 – snaut