获取当前节点的父节点名的正确语法是什么?我知道这是关于AxisName父级的,但是正确的语法是什么呢?例如,下面的xml
<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" location="file:/dev/null" iosp="lasp.tss.iosp.ValueGeneratorIOSP" start="0" increment="1">
<attribute name="title" value="Vector time series"/>
<dimension name="time" length="100"/>
<variable name="time" shape="time" type="double">
<attribute name="units" type="String" value="seconds since 1970-01-01T00:00"/>
</variable>
<group name="Vector" tsdsType="Structure" shape="time">
<variable name="x" shape="time" type="double"/>
<variable name="y" shape="time" type="double"/>
<variable name="z" shape="time" type="double"/>
</group>
</netcdf>对于元素变量,我应该获取netcdf或group。提前谢谢。
发布于 2011-08-11 20:41:44
使用的
name(..)..是parent::node()的缩写。
请注意:并不是每个父母都有名字。例如,文档节点(/)是文档的顶部元素(/*)的父节点,并且没有名称。
发布于 2011-08-11 16:40:06
name(parent::*)应该做到这一点。很明显,只会有一个家长。
https://stackoverflow.com/questions/7023024
复制相似问题