I have an XML as follows
<demos>
<demo>
<a>00</a>
<b>First</b>
<c>ProjectA</c>
</demo>
<demo>
<a>01</a>
<b>Second</b>
<c>ProjectB</c>
</demo>
</demos>
Example 1: If within <a> tag has 00 and <c> tag has ProjectA, Output should be First
Example 2: If within <a> tag has 01 and <c> tag has ProjectB, Output should be Second
I want try with xml_grep or xpath as these are installed packages in linux by default. I tried different ways such as
xpath xtest.xml '//a[text()="01"]/text() | //b'
but this validation doesnt work.
Ifconditions in your question are true for the sample XML. What should be the output?xpath -e '//a[text()="01"]/text() | //b' xtest.xmlinstead.