Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Separate a single xml into mulitple XML using perl

by GrandFather (Saint)
on Jan 06, 2016 at 07:11 UTC ( [id://1152047]=note: print w/replies, xml ) Need Help??


in reply to Separate a single xml into mulitple XML using perl

XML::Simple is designed for simple XML documents. It is not designed to be a simple to use XML parser. Trying to do "interesting" stuff with XML::Simple is a recipe for misery. In the long run (say in an hour) converting to something like XML::Twig will be less tedious and make your life much happier than persisting in trying to hammer XML::Simple into shape for a job it wasn't designed for.

Seriously, have a serious crack at using XML::Twig. If you haven't made solid progress in an hour come back for some tips.

Premature optimization is the root of all job security
  • Comment on Re: Separate a single xml into mulitple XML using perl

Replies are listed 'Best First'.
Re^2: Separate a single xml into mulitple XML using perl
by gr.d (Novice) on Jan 06, 2016 at 07:22 UTC

    I do find XML::Twig pretty easier, My superiors are so adamant on sticking to XML::Simple, I don't get a say in that. That's the reason as of now I'm sticking with XML::Simple. But can anything be done on the code I posted? Really appreciate the help

      My superiors are so adamant on sticking to XML::Simple
      Perhaps you should try to have them read this: XML::Simple needs to go!

      See Simpler than XML::Simple

      If you have XML::Simple, you most likely also have XML::Parser & XML::Parser::Expat. XML::Rules is a plain Perl module on top of XML::Parser::Expat, so you don't really need to build and install it into the Perl directories, you can use it as a module you write yourself and copy it with the rest of your app/scripts.

      I believe you can do the same with XML::Twig.

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

      But can anything be done on the code I posted?

      Yes, it can be ignored :)

      It doesn't use XML::Simple, its parsing xml by hand

      The xml file you posted isn't valid

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-26 00:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found