XPath fetch dynamic http header values

Following is an XPath that can come in handy to read name value pair elements.

Basically this is done for reading tibco dynamic headers which comes as a repeated header containing name and value elements but the below xpath can be used for any XML document processing.

Below is the XML and XPath example

<DanamicHeaders> <Header> <Name>api_key1</Name>  <Value>key1</Value>  </Header><Header>  <Name>api_key2</Name>  <Value>key2</Value>  </Header><DanamicHeaders>
/DynamicHeaders//Header[Name/text()='api_key1']/Value/text()

The above xpath evaluates to value “key1”

About: Muhammad Ali

I am a Java and Tibco expert. I have Master's degree in software engineering of distributed systems from Royal Institute of technology KTH Stockholm Sweden and I am an expert software engineer and integrator with over a decade of industry experience from Europe, Gulf and Asia regions. I am a strong opensource believer and encourage "sharing as caring" principle.