0
我正在尝试遵循this guide。我可以打印我的XML像这样:使用R解析XML将返回空字符串
> print(deps[1:2])
$deployment
<deployment id="0">
<deploy t="0" u="2"/>
<deploy t="1" u="2"/>
<deploy t="2" u="2"/>
<deploy t="3" u="2"/>
<deploy t="4" u="5"/>
<deploy t="5" u="2"/>
<metric name="makespan" value="23"/>
<rmetric name="total_cpu_cycles" value="16340"/>
</deployment>
$deployment
<deployment id="1">
<deploy t="0" u="2"/>
<deploy t="1" u="2"/>
<deploy t="2" u="2"/>
<deploy t="3" u="2"/>
<deploy t="4" u="5"/>
<deploy t="5" u="2"/>
<metric name="makespan" value="23"/>
<rmetric name="total_cpu_cycles" value="16350"/>
</deployment>
attr(,"class")
[1] "XMLNodeList"
我想是一个矩阵,其中每行是一个部署,有两列(“完工”,“total_cpu_cycles”)。
当我到了这一步,我开始看到问题:
> depcat = xmlSApply(deps, function(x) xmlSApply(x, xmlValue))
> depcat[1,1]
[[1]]
character(0)
> str(depcat[1,1])
List of 1
$ : chr(0)