得到 House 中的所有房間(直接孩子名為 Room)

XML

<House>
    <numRooms>4</numRooms>
    <Room name="living"/>
    <Room name="master bedroom"/>
    <Room name="kids' bedroom"/>
    <Room name="kitchen"/>
</House>

XPATH

/House/child::Room

要麼

/House/*[local-name()='Room']

OUTPUT

<Room name="living" />
<Room name="master bedroom" />
<Room name="kids' bedroom" />
<Room name="kitchen" />