0

I have log files that I wish to parse the xml with certain condition

a sample of the log file

<Text>
    ns:="https://www.example.com"
    <Error>
        <id>ex8359693589435834583985934583495</id>
        <ErrorItem>
            <id>slak;jdk;asjdklasjdklasjdfhkldj;sfjdsf</id>
            <code>404</code>
            <description>External>  failed messages multiple line of detials </description>
            <reference>/</reference>
        </ErrorItem>
    </Error>
    <InformationLog>
        <cccpInformation>
            <description>External>  failed messages multiple line of detials 2 </description>
            <Place>
                <id>988475748848758478545</id>
            </Place>
        </cccpInformation>
    </InformationLog>
</Text>

Basically, I only want to capture the <description> tag only in <ErrorItem></ErrorItem>, and nothing else. and the logs also contain description tag on other level of the tag

But the post like Find everything between two XML tags with RegEx

will only capture the tag next under/next to it.

I can achieve some basic matching using something like (?s)<ErrorItem>(.*?)<\/description>

but it will select everything inside <ErrorItem> </ErrorItem>

Anyone can give me a hand here?

DesAwsome
  • 1
  • 3

0 Answers0