Hi All,
I have an XML File as below:
<?xml version="1.0" encoding="UTF-8"?>
<ServiceChangeRequest Operation="Activate" SubscriberKey="|IMSI_NUMBER
+|" AlternateSubscriberKey="|MSISDN_NUMBER|" Refresh="false">
<RequiredServices>
<ServiceDescription ServiceTag="|service|">
<ParameterDesc ParameterTag="MSISDN" Parameter
+Value="|MSISDN_NUMBER|"/>
<ParameterDesc ParameterTag="SCPId" ParameterV
+alue="|SCPID|"/>
<ParameterDesc ParameterTag="ServiceClass" Par
+ameterValue="|service_class|"/>
<ParameterDesc ParameterTag="PromotionPlan" Pa
+rameterValue="|promo_plan|"/>
</ServiceDescription>
<ServiceDescription ServiceTag="VMSS">
<ParameterDesc ParameterTag="VMSMSISDN" Parame
+terValue="|VMSMSISDN_NUM|"/>
</ServiceDescription>
<ServiceDescription ServiceTag="VCFD"/
+>
<ServiceDescription ServiceTag="CALW"/
+>
<ServiceDescription ServiceTag="AUC">
<ParameterDesc ParameterTag="KI" ParameterValu
+e="|KI|"/>
</ServiceDescription>
<ServiceDescription ServiceTag="CONTENT"/>
<ServiceDescription ServiceTag="GPRS"/>
<ServiceDescription ServiceTag="CAMEL"/>
<ServiceDescription ServiceTag="APNWAP"/>
<ServiceDescription ServiceTag="APNMMS"/>
</RequiredServices>
</ServiceChangeRequest>
In the above XML file, I have pipe '|' delimited entered eg. : |MSISDN_NUMBER|
I want to split the file according to pipe delimited format. Below is the code that I have written:
#!/usr/bin/perl
open(FILE, 'removed.xml') or die "Can't read file 'filename' [$!]\n";
+
while (<FILE>) { $document .= $_ }
print "document is $document\n";
@lines = split("\|",$document);
for ($i=0;$i< @lines;$i++) {
print "$_\n";
}
I have read from an XML file called removed.xml into variable $document.
Now the problem is the @lines does not show any output.
Can you please suggest a way in which the XML file can be splitted according to '|' pipe delimited format.
Sorry: My mistake, I got the output, please apologize,my question is itself wrong
Thanks
Arun