S
S
Stels0072017-12-14 11:25:05
XML
Stels007, 2017-12-14 11:25:05

xml. How to find a node by its value?

Hello! Faced such a problem: you need to find an element and access it by value, namely by InnerText.
Here is the file structure:

<?xml version="1.0" encoding="UTF-8"?>
-<head>
-<Klassi>
<klass>Класс 1</klass>
<klass>Класс 2</klass>
<klass>Класс 3</klass>
<klass>Класс 4</klass>
<klass>Класс 5</klass>
-<klass>
Класс 7
<gruppa>А</gruppa>
<gruppa>Б</gruppa>
<gruppa>В</gruppa>
</klass>
</Klassi>
</head>

In this case, it is required to read the group values ​​of the "Class 7" element. Tell me how to do it?
Ps Other elements will have the same groups, i.e. Class 8 will have its own letters, and so on.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2017-12-14
@Stels007

//Klassi/klass[contains(., 'Класс 7')]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question