Dear community,
I have a big XML log file containing several rows splitted by tag: <ActivityLogRecord> and </ActivityLogRecord>. An example below.
What I need is read the file and extract some value from each tags and put them into one line (each line for every <ActivityLogRecord> tag).
So in the example the output should be:
COSID='88',true,Value='393290439266'
The problem where I'm scratching my head is that sometimes this field is missing: <WhoCalledOn>true</WhoCalledOn> and this could be reported twice, something like:
<Identifier Type='TelephoneNumber' Value='324234231443'/>
<Identifier Type='TelephoneNumber' Value='324234231443'/>
This means the output I need should be:
COSID='88',true,Value='393290439266',null
COSID='88',null,Value='393290439266',Value='393290439266'
In other words, if the tag WhoCalledOn is missing, I should report in output something like NULL, otherwise put the value like true o false. Same thing for the TelephoneNumber tag. If reported only one, the second column should be set as NULL, otherwise report the value.
Well, I know, this is not properly simple, that's why I'm asking to the expert!
Thank you
Lucas
<ActivityLogRecord>
<Common COSID='88' DomainID='BL' EndTimeStamp='2016-03-23T10:00:00.10+01:00' MainAction='Modify Subscriber' ReferenceNumber='192.9.224.15-1455979927516' ServerID='omu234234' ServiceName='SPM' StartTimeStamp='2016-03-23T09:59:59.850+01:00' UserID='234234234234' UserTerminal='vxv_app_user'>
<MainActionResult Description='ERROR: 0 - Action completed successfully' Status='Success'/>
</Common>
<ServiceSpecific>
<Provisioning xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<Request>
<Header>
<Command>Modify</Command>
<EntityIdentifiers>
<Identifier Value='324234231443'/>
</EntityIdentifiers>
<Data>
<Subscriber>
<WhoCalledOn>true</WhoCalledOn>
</Subscriber>
</Data>
<HostReference>Automatic</HostReference>
</Header>
<Data>
<Subscriber>
<SubscriberCosName>8</SubscriberCosName>
<SubscriberDomainName>Default domain</SubscriberDomainName>
</Subscriber>
</Data>
</Request>
</Provisioning>
<Provisioning xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<Response>
<Header>
<EntityIdentifiers>
<Identifier Type='TelephoneNumber' Value='324234231443'/>
</EntityIdentifiers>
<EntityName>Subscriber</EntityName>
<HostReference>Automatic</HostReference>
<ResponseStatus>Success</ResponseStatus>
</Header>
</Response>
</Provisioning>
</ServiceSpecific>
</ActivityLogRecord>