Perl5 regex to match and get values of two tags regardless of their position



I have an XML like below where I want to get the values of the tags customerid and participationtype regardless of their position inside ASObject.


I have tried to write regex like below which is not working when the order of the tags is not matched.



<customerid tagClass="double">(.*)</customerid>([^^]*?)<participationtype tagClass="String">(clmt|insrd)</participationtype>


XML:



<ASObject mappedClass="com.taliantsoftware.insurance.participation.ParticipantSummaryDTO">
<customertype tagClass="String">prsn</customertype>
<linkednoteindicator tagClass="boolean">false</linkednoteindicator>
<new tagClass="boolean">true</new>
<customerid tagClass="double">3209053.0</customerid>
<participationtype tagClass="String">clmt</participationtype>
<updated tagClass="boolean">true</updated>
<voided tagClass="boolean">false</voided>
<blockexist tagClass="boolean">false</blockexist>
<participationid tagClass="double">2664273.0</participationid>
<customername tagClass="String">MELISSA M. CORNWELL</customername>
<customerphonenumber tagClass="String">3303660069</customerphonenumber>
<effectivedate tagClass="Date">1997-03-02 19:00:00.0 EST</effectivedate>
</ASObject>

No comments:

Post a Comment