I have a XML embedded in another XML with escape characters
<Audit>
<tracker>XXXXX123</tracker>
<Message><?xml version="1.0" encoding="UTF-8"?><ABCxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:qu="http://qqqq.xsd" xmlns:v1="http://www" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<RM>
<Code>111</Code>
<State>Avilable</State>
</RM>
<RM>
<Code>222</Code>
<State>Not avilable</State>
</RM>
<RM>
<Code>333</Code>
<State>Not sure</State>
</RM>
</ABC>
</Message>
</Audit>
I am suing below command to extract and convert the embedded XML to correct format. This page is not allow to how escape characters so removed the ";"
| rex "\<Message\>(?<Message>.*)\<\/Message\>"
| eval Message1 = replace (Message,"<","<")
| eval Message2 = replace (Message1,">",">")
| eval Message3 = replace (Message2,""","\"")
Message3 giving below output
<?xml version="1.0" encoding="UTF-8"?><ABC xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:qu="http://qqqq.xsd" xmlns:v1="http://www" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<RM>
<Code>111</Code>
<State>Avilable</State>
</RM>
<RM>
<Code>222</Code>
<State>Not avilable</State>
</RM>
<RM>
<Code>333</Code>
<State>Not sure</State>
</RM>
</ABC>
Now I want to get RM in to one veriable if state is = “Not available”. I am using below command for that.
| xpath field=Message3 "// ABC / RM [State=' Not available ']" outfield=NAV
But NAV is not giving any result. Can you please help to fix the issue ?
... View more