0

The below data is xml file. Here actual,msg,time,type are attributes.


<properties>    
    <inputs>
        <action actual="0xAB" msg="GENERAL.GROUPING.TAG" time="00:00:00.825" type="SET" />
        <action actual="0xCD" msg="GENERAL.GROUPING.LENGTH" time="00:00:00.826" type="SET" />
        <action actual="0xEF" msg="GENERAL.GROUPING.TRANSACTION_ID" time="00:00:00.826" type="SET" />
        <action actual="0xGH" msg="GENERAL.GROUPING.ORIGINATOR_SYSTEM_TITLE" time="00:00:00.827" type="SET" />
        <action actual="0xIJ" msg="GENERAL.GROUPING.VALUE" time="00:00:00.827" type="SET" />
        <action actual="0xKL" msg="GENERAL.GROUPING.TITLE.LENGTH" time="00:00:00.827" type="SET" />
        <action actual="0xMN" msg="GENERAL.GROUPING.TITLE.VALUE" time="00:00:00.828" type="SET" />
        <action actual="0xOP" msg="GENERAL.GROUPING.DATE" time="00:00:00.828" type="SET" />
    </inputs>
</properties>  

I want to return attribute value of actual="0xAB" when attribute msg="GENERAL.GROUPING.TAG". So depending on attribute 'msg' value I want to print attribute 'actual' value Kindly help in this issue with example.

1
  • What did you try so far, can you add it to the question? Commented Sep 15, 2020 at 15:34

1 Answer 1

1

You can use this XPath-1.0 expression:

//action[@msg='GENERAL.GROUPING.TAG']/@actual

It returns the attribute value 0xAB.

Sign up to request clarification or add additional context in comments.

2 Comments

@priyas instead of thanks you could have accepted the answer by clicking on the hollow tick right beside the answer
i clicked on hollow tick

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.