Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^3: XML Tags Stripping & Calculating checksum on it

by ady (Deacon)
on Jul 17, 2008 at 13:00 UTC ( #698289=note: print w/replies, xml ) Need Help??


in reply to Re^2: XML Tags Stripping & Calculating checksum on it
in thread XML Tags Stripping & Calculating checksum on it

my $data = do { local( $/ ) ; <$XmlFile> } ; # Slurp file $data =~ s!(^\s*)?\<(TotalAmount|NoOfRecords|TotalBatch|CurrentBatch|E +ODTransactionDate|BankFileSeqNo|TotAmount)\>(.+?)\<\/\1\>\n?!!mig; +# Zap headers $data =~ s!(^\s*)?</?.*?>\n?!!mig; # Zap xml tags CRC32($data); # CRC remaining data
Should be fast, but in general regex'ing x/html is fragile and NOT recommended.
(implicit assumptions about the data content is one of the traps, -- which may/not apply in your case).
You probably should use XML::Twig instead!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://698289]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2022-08-08 18:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?