XPath Parsing

I am trying to use XPATH to extract the Section after the Header having a value of ‘Sub Classes’

<Section>
<Header>Sub Classes</Header>
<Section>
<Header>Chemical</Header>
</Section>

Is there a way to do this using XPATH? I have tried a few different variations such as “Header[Header=‘Sub Classes’]/Section”, but only get a blank cell. I am not that familiar with xpath, thank you!

Hi @zhuma

Is it right that you omitted one </Section> tag after the first header?

<Section>
<Header>Sub Classes</Header>
</Section>
<Section>
<Header>Chemical</Header>
</Section>

You should be able to get the desired result with //Header[text()='Sub Classes'] as query.

1 Like

Thanks for the quick response! Unfortunately, I could not get this to work. I get missing cells. The full preview of my data is as follows:

Untitled

In this case, I would like for “Chemical” to be returned.

I was able to get it using //*[text()=‘Sub Classes’]/following::text()[1]. Thanks for your help!

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.