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