I need to reading from XML and write to XML through Perl. I don't know which packages to be installed. I am using Fedora Core 6. Please help me out to resolve this.
you can try XML-Simple
http://search.cpan.org/~grantm/XML-Simple-2.18/lib/XML/Simple.pm
or XML::Smart
http://search.cpan.org/~gmpassos/XML-Smart-1.6.9/lib/XML/Smart.pm
Twig used to be one of the best APIs (a few years back that was - so it might have changed)
There seems to be a Fedora package for it. I guess you can install it like this:
yum install perl-XML-Twig
That should install other dependencies like Expat, XML::Parser and so on.
XML::Twig
(as recommended by Maxwell Troy Milton King) is certainly a powerful tool for XML processing in Perl. I can second that recommendation and offer an alternative.
An alternative would be XML::LibXML
. This includes "standards-based" features such as XPath (XML::LibXML::XPathContext
is usually needed), SAX and I'm pretty sure there's an XSLT processor that accepts LibXML DOM objects.
It does of course depend on what kind of processing you're doing any any other requirements. Perhaps if you can't decide between the answers here, post some more detail on the processing.
If by "writing XML", you mean outputting transformed documents then the tool you use to read in and transform should be all you need. If you wish to have something help you create correct new XML documents, I've never used a library for that but a former colleague of mine created XML::Genx, a wrapper around the C library genx
- so presumably he thought that was good ;-)
Afraid I don't know how to install on Fedora, but I expect you would find it easier to consider that a separate problem to deciding which libraries to install ;-).