Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Kindly suggest a good starting point for XML Parsing.

by sundialsvc4 (Abbot)
on Dec 29, 2011 at 15:41 UTC ( #945519=note: print w/replies, xml ) Need Help??


in reply to Re: Kindly suggest a good starting point for XML Parsing.
in thread Kindly suggest a good starting point for XML Parsing.

For what it's worth, XML::Simple has “left me standing at the altar” a few more times than I personally care for.   XML-related tasks that start out as “simple” just don’t stay that way for long, and it is rather annoying to run into the limits of your tool before you run into the limits of your project.

  • Comment on Re^2: Kindly suggest a good starting point for XML Parsing.

Replies are listed 'Best First'.
Re^3: Kindly suggest a good starting point for XML Parsing.
by cavac (Deacon) on Dec 29, 2011 at 22:10 UTC

    it is rather annoying to run into the limits of your tool before you run into the limits of your project.

    Yes it is. I'm currently in the planing phase on how to rewrite my big projects XML config parser. Which, incidently, is XML::Simple based. While it works quite nicely, it takes some, uh, not-so-nice workaround thinking when writing the config files itself. I must admit, when i started this project, it was the first time i used XML for configuration files. And it was Plug-and-Play, really and saved me quite some time to get started.

    Still, i'll probably keep XML::Simple around for all those small convert-this-into-that tools. For the typical ten-settings-and-five-comments config files for these kind of tools it is just ideal.

    So, XML::Simple is a two sided sword. It highly depends on your requirements.

    BREW /very/strong/coffee HTTP/1.1
    Host: goodmorning.example.com
    
    418 I'm a teapot
      As are all fine weapons . . . this is understood.
Re^3: Kindly suggest a good starting point for XML Parsing.
by mrguy123 (Hermit) on Dec 29, 2011 at 20:49 UTC
    I agree with you that XML::Simple is sometimes a bit, um, simple, and it is highly recommended to learn the more powerful XML parsers mentioned above.
    Still, for those rare cases where a very easy to use and "simple" tool can be useful, its a nice thing to know.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://945519]
help
Chatterbox?
[Cosmic37]: now I have tried another blunder - can anyone explain why I am such a dunderhead?
[Cosmic37]: if ( $line =~ /$mydt/ ) { print $line; }
[Cosmic37]: I try to match successive date times stored in variable $mydt
[Cosmic37]: I guess it is searching for the string "$mydt"
[Corion]: Indeed cool, erix ;)
[Cosmic37]: rather than the value of $mydt which is a date time strong such as 2016-01-01 12:30:56
[Corion]: Cosmic37: No, but maybe $mydt doesn't contain what you think it does, or it contains characters that are special in a regular expression? Try if( $line =~ /\Q$mydt\E/) { ... for a literal match
[Cosmic37]: I mean string grrr
[Corion]: Maybe add an else branch in which you print what the values of $line and $mydt are?
[Cosmic37]: ah thank you I will try

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (11)
As of 2017-06-29 16:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (673 votes). Check out past polls.