Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

XML and Perl

by ezekiel (Pilgrim)
on May 23, 2002 at 04:58 UTC ( [id://168653]=perlquestion: print w/replies, xml ) Need Help??

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

I'm wanting to use Perl to process (read and write) XML files. A search on 'XML' here gives no hits, and a Module search on CPAN returns 462 hits. Could someone point me to a good place to start?

Basically I am wanting to use a DTD to create a web form, have a user fill in the values, and then create an XML document based on the responses. Subsequently, I want to read an XML document, extract the data and element information, manipulate it, and display it back to the user.

I'm sure modules to read/parse/write XML and DTD documents must already exist. I'm just not sure which ones I should start with.

Thanks.

Replies are listed 'Best First'.
Re: XML and Perl
by DigitalKitty (Parson) on May 23, 2002 at 05:20 UTC
    Hi.

    A good place to start would be O'Reilly's new book:

    Title: Perl & XML
    ISBN: 0-596-00205-X
    Price: $34.95 US

    More info on this title can be found here:

    http://www.oreilly.com/catalog/perlxml/

    As far as modules are concerned, I would suggest exploring:
    • XML::Generator
    • XML::Simple
    • XML::Twig
    • XML::TokeParser
    • XML::Writer

    These are all available on the ActiveState repository as well.
    Hope this helps,

    -Katie.
Re: XML and Perl
by LD2 (Curate) on May 23, 2002 at 05:26 UTC
Re: XML and Perl
by mirod (Canon) on May 23, 2002 at 05:32 UTC
Re: XML and Perl
by ajt (Prior) on May 23, 2002 at 08:00 UTC
    In addition to what others have mentioned, you may also wish to look at XML::LibXML and XML::LibXSLT, which are very fast, modern, GNOME c based modules that are very powerful.

    Kip Hampton has an interesting set of articles at XML.com which are well worth reading.

    There is also the dedicated Perl-XML Mailing list, which many here also frequent.

    Recently the Perl-XML documentation site underwent an excellent upgrade, and there is lots of useful stuff in there aswell.

    O'Reilly have some excellent books, including: ISBN 0596000588; ISBN 0596000537; ISBN 0596000464 and ISBN 0596001339 - also watch their New Books as XML is still running hot and news books come out frequently!

    You will also discover that a few monks here also wrote some of the excellent XML modules available, and many of us have used them, so you should be able to get help fairly quickly should you need it.

    Good luck!

      ++ajt.

      I'm a big fan of XML::LibXML and XML::LibXSLT. If you are interested in all things XML this node gave me some great ideas.
Re: XML and Perl
by cjf (Parson) on May 23, 2002 at 05:29 UTC
Re: XML and Perl
by dws (Chancellor) on May 23, 2002 at 05:46 UTC
    A search on 'XML' here gives no hits, ...

    You're encountered a very unfortunate side-effect of an "optimization" in site searching that ignores terms of 3 characters or less. There's actually quite a bit of XML stuff here. Try searching for "Parser".

Re: XML and Perl
by drfrog (Deacon) on May 23, 2002 at 16:48 UTC
    i too would suggest XML::LibXML and XML::LibXSLT

    here is a sample snippet, almost directly from synopsis:
    use XML::LibXML; use XML::LibXSLT; my $xmlIn = shift;#scalar my $xslIn = shift;#scalar my $parser = XML::LibXML->new(); my $xslt = XML::LibXSLT->new(); my $source = $parser->parse_string($xmlIn); my $style_doc = $parser->parse_string($xslIn) ; my $stylesheet = $xslt->parse_stylesheet($style_doc); my $results = $stylesheet->transform($source); my $outputStr = $stylesheet->output_string($results); return $outputStr;
Re: XML and Perl
by krujos (Curate) on May 23, 2002 at 16:24 UTC
    In addition to everyone else’s excellent suggestions you might want to check out XML::DOM::ValParser, XML::Checker, XML::Checker::Parser they are all on cpan with a search for XML. Look about 1/3 down the page. I have used Checker and the DOM validating parser with excellent results in the past. I actually did something very close to what your trying to do with all of this and these modules worked very well for me, especially XML::DOM::ValParser.
    Good Luck
    . ---Mogaka is good
Re: XML and Perl
by meonkeys (Chaplain) on May 23, 2002 at 17:26 UTC
    I have to plug my tutorial. It's quite simple, and might help you get your feet wet.

    ---
    "A Jedi uses the Force for knowledge and defense, never for attack."
Re: XML and Perl
by inblosam (Monk) on May 23, 2002 at 19:55 UTC
    I also recommend using the Super Search on this site. More options than the regular search. Like someone else said, you should search for parser, not just XML, because of letter minimums.

    Michael Jensen
    michael at inshift.com
    http://www.inshift.com
Re: XML and Perl
by P0w3rK!d (Pilgrim) on May 23, 2002 at 18:50 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-03-19 02:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found