Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Best module for Creating [Writing out] XML

by Anonymous Monk
on Oct 19, 2013 at 14:50 UTC ( [id://1058921]=perlquestion: print w/replies, xml ) Need Help??

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

Hello Monks,

Pls guide me in selecting a good module for creating XML outs. I tried XML::Simple but its not giving the output in the proper order, its getting shuffled. Is XML::LibXML the Best? somebody suggested me like its the best option right now. i am sure PerlMonks know better. Pls guide me through.

Regards,

Stephen

  • Comment on Best module for Creating [Writing out] XML

Replies are listed 'Best First'.
Re: Best module for Creating [Writing out] XML
by marto (Cardinal) on Oct 19, 2013 at 15:26 UTC
      Yes, I meant the elements. Is XML::LibXML the current best? that post is 8 years old!

        Define "best"? The link I gave you contains posts about other modules, perhaps you should read them since you have yet to tell us exactly what you want to achieve, what "best" means in this case.

Re: Best module for Creating [Writing out] XML
by bitingduck (Chaplain) on Oct 19, 2013 at 17:07 UTC

    For something with a more control than XML::Simple, and not as steep a learning curve as the full XML::LibXML, you might want to try XML::TreeBuilder. All of the parts of the documentation that you probably want are actually in HTML::Element, which is a subclass. It's straightforward to use, if a bit tedious sometimes, if you want to build a well behaved tree of XML or HTML.

    But as far as "best", it really depends on what you need to optimize. I often use different modules that cover related functions depending on whether it's a quick hack or something I want to be able to expand later.

Re: Best module for Creating [Writing out] XML
by aitap (Curate) on Oct 19, 2013 at 21:21 UTC

    I found XML::Writer to be convinient to write XML files in stream mode (i.e. "start tag A, start tag B with attribute C = "1", print XML-encoded data, close two tags"). It probably won't be so easy to work with it if you already have a tree of data to serialize, and complex things like automatic schema validation and namespace fetching are not implemented, but otherwise XML::Writer can help you.

Re: Best module for Creating [Writing out] XML
by ambrus (Abbot) on Oct 19, 2013 at 19:34 UTC
Re: Best module for Creating [Writing out] XML
by boftx (Deacon) on Oct 19, 2013 at 16:54 UTC

    Depending upon the complexity of what you create, you might find it easier (and possibly more efficient) to use Template or even the qq operator to create your records with the exact order/structure you want.

    I have always found creating XML to be a simple task, bordering on trivial. It is the decoding that always a pain with regard to efficiency and/or resources required.

    The answer to the question "Can we do this?" is always an emphatic "Yes!" Just give me enough time and money.
Re: Best module for Creating [Writing out] XML
by LanX (Saint) on Oct 19, 2013 at 14:56 UTC
      No,Gangnam shuffle!!! :D

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-26 07:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found