in reply to Re^3: The best way to handle different type of XML files
in thread The best way to handle different type of XML files

I don't believe it. Let's compare the parsers by extracting the Person elements from the following very common structure:

... <Persons> <Person>...</Person> <Person>...</Person> <Person>...</Person> </Persons> ...

The Persons element is optional and the number of Person elements is variable.

Did I pick an example that XML::Simple handles poorly? Let's do another extremely common example to demonstrate otherwise. Let's extract the person's country.

... <Person> ... <Country ...>...</Country> ... </Person> ...

XML::Simple code is insane without a schema. It's much simpler with, but it's still longer and messier than with XML::LibXML. And it takes a lot of up-front time time to create the schema and lots of headaches from making mistakes.

With XML::LibXML, I don't have to do any of that up-front extra work XML::Simple requires. so in addition to being a better production parser (simpler, 50x faster, etc), it's a better prototyping parser too.

  • Comment on Re^4: The best way to handle different type of XML files (Why I don't think much of XML::Simple)
  • Select or Download Code

Replies are listed 'Best First'.
Re^5: The best way to handle different type of XML files
by mpeever (Friar) on Nov 22, 2009 at 22:02 UTC
    XML::Simple code is insane without a schema. It's much simpler with, but it's still longer and messier than with XML::LibXML. And it takes a lot of up-front time time to create the schema and lots of headaches from making mistakes. With XML::LibXML, I don't have to do any of that up-front extra work XML::Simple requires. so in addition to being a better production parser (simpler, 50x faster, etc), it's a better prototyping parser too.

    You got me thinking, and I think you're probably right.

    I'm playing with it now...