pavanmach has asked for the wisdom of the Perl Monks concerning the following question:

my $xml_obj = XML::Simple::Tree->new(file => 'directory.xml', node_key => 'dir', target_key => 'name'); I have been studying the documentation for XML::Simple::Tree. But i am + bit confused about node_key and target_key in the above code. Can an +ybody please tell me what node_key and target_key actually mean ? And + what are values supplied to them ?

Replies are listed 'Best First'.
Re: XML simple tree
by ikegami (Patriarch) on Jan 22, 2010 at 08:19 UTC
    Looking at the data file used by the distro's test cases gives a clue
Re: XML simple tree
by Corion (Patriarch) on Jan 22, 2010 at 08:22 UTC
Re: XML simple tree
by Jenda (Abbot) on Jan 22, 2010 at 14:32 UTC

    (You should have closed the <code> tag after the semicolon.)

    I've read the module's documentation and I still don' get it. I mean the whole point of XML::Simple (as I understand it) was to convert as simply as possible a XML into a plain old convenient Perl data structure. And here they wrap it up again in some classes ...

    Anyway the module hadn't been touched since 2005, the docs are lacking, it had never (as far as I can tell) been evangelized anywhere ... I think it's best to stay away. Unless it really exactly matches your needs. You would have problems finding people that can help you with any problems.

    Which means that my question is ... what are actually your needs? What other modules did you consider using? You are quite likely to find help with XML::LibXML, XML::Twig, XML::Simple(some of the responses telling you not to use it) and XML::Rules, any of them might be the right one for you?

    Jenda
    Enoch was right!
    Enjoy the last years of Rome.