1

ノードのすべての直接および非リーフの子のみを取得する xpath 式が必要です。

このような XML ツリーの式を実行すると、次のようになります。

<root>
<attribute1>a</attribute1>
<attribute2>b</attribute2>
<attribute3>c</attribute3>  
<ElementA>
    <ElementB>
        <ElementC>AC</ElementC>
    </ElementB>
</ElementA>
<ElementX>
    <ElementB1>
        <ElementC1>C1</ElementC1>
    </ElementB1>
</ElementX>
<Other>
    <ElementB2>B2</ElementB2>
</Other>
<NewOne>
    <ElementB3>
        <ElementC3>
            <ElementC4>C4</ElementC4>
        </ElementC3>
    </ElementB3>
</NewOne>
 </root>

ElementA、ElementX、Other、NewOne を取得する必要があります。

助けてくれてありがとう。

4

1 に答える 1

4

これは:

/root/*[*]

(述語は、選択したノードに少なくとも 1 つの子があることを確認するためにあります)

于 2013-01-17T17:07:43.710 に答える