Riyafa Abdul Hameed
Riyafa Abdul Hameed

Reputation: 7973

xpath to get two entries

I have an xml with several entries as follows (along with other tags as well)

    <entry>
        <id>
            https://spreadsheets.google.com/feeds/cells/14sCud5RqFt7O44Ol_GnTBgwFbZSnWAW-dJ833ryfWY8/1/private/full/R4C3
        </id>
        <updated>2015-12-02T05:49:20.867Z</updated>
    </entry>
<entry>
        <id>https://spreadsheets.google.com/feeds/cells/14sCud5RqFt7O44Ol_GnTBgwFbZSnWAW-dJ833ryfWY8/1/private/full/R3C2
        </id>
        <updated>2015-12-02T05:49:20.867Z</updated>
</entry>

I would like to get first two <entry> tags using a single xpath expression. Can I do this using xpath? If so how.

Upvotes: 0

Views: 32

Answers (1)

Dmytro Pastovenskyi
Dmytro Pastovenskyi

Reputation: 5419

Like this.

//entry[position()<3]

Upvotes: 3

Related Questions