Problems? Is your data what you think it is? | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
No, no and no, for all 3 "parse with index and substr" snippets. How hard is it to use XML::Simple, especially as I believe it can now accept SAX input, and thus does not depend on XML::Parser anymore, so you can use XML::SAX::PurePerl, Matts pure Perl XML parser. You are not parsing XML here, you are parsing the exact format of the message _today_. Any extra piece of information added, any comment would break this parser, while proper XML code (ie based on a real XML parser) would do just fine. There are plenty of ways the format of the ticker could be changed while the XML view would remain the same: added entities, comments, namespace declarations, you name it... Only a proper XML parser will allow you to extract the information regardless of the exact way the XML is "physically encoded". You can have fun with this code, but I don't think it is a good thing to show it here. I suggest you write a second version of those tools using XML::Simple and XML::SAX::PureSax, this way you will learn something, help others by showing them the proper way to process XML, and even garner some ++ in the process. In reply to Re: parse the "Other Users XML Ticker" with index and substr
by mirod
|
|