I need to write a quick program to parse through a logfile that has both log entries with dates and XML imbedded in the file. The following snippet is an example of the type of data we see in the file.
Feb 30 10:55:23: [B:S:0:12345abcd:Information] Information
Feb 30 10:55:23: Before converting xml into DOM in the XMLRespToEvent
+method
Feb 30 10:55:23: The xmlString before parsing is : <?xml version="1.0"
+ encoding="ISO-8859-1" ?>
<outputGetSubscriptionInfo ixc="">
<svcAsgmInfo svcEffDt="2002-04-29" svcExprDt="9999-12-31" salesChnlI
+d="CC">
<primarySvc svcNm="F W-CTP" svcId="abcdefghij:" svcTyp="PK" svcDes
+c="Basic service &MWI" srchCategory="PK" extnClassNm="COM_SVC">
<depositAmt/>
<charge chgTypeCd="R" chgStDt="2001-08-01">
<chgAmt amntDue="0.00"/>
</charge>
I have written the following snippet to read the file:
while (<LOGDATA>) {
$logline=$_;
print ("The whole line is ---> ",$logline);
}
Whenever the program hits a line with the XML it just prints a blank line. Any ideas? Also, after writing a general parsing engine I will need to write another program to parse through the XML. Best recommendations?
Thanks in advance!!!!!
Rich
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.