user1107888
user1107888

Reputation: 1525

Parsing XML tags with small difference in names

I have an XML file to parse in which the element tags are of the form:

<mensa-1>
..
</mensa-1>

<mensa-2>
..
</mensa-2>

Is it possible to parse such elements via Xpath when the element names differ via a number at the end?

Upvotes: 0

Views: 32

Answers (1)

choroba
choroba

Reputation: 242218

The following XPath expression returns all the elements whose names start with "mensa-":

//*[starts-with(name(),'mensa-')]

Upvotes: 1

Related Questions