On Tue, Apr 20, 2010 at 8:23 PM, newbie01 perl <newbie01.p...@gmail.com> wrote: > I want to be able to convert the XML file to a text file ...
XML /is/ text. :\ You can just open an XML file with any text editor (that supports the text encoding) and edit it by hand. :\ Now, you might want to prettify it (format it, with newlines and indentation) to make it easier to edit by hand. There are tools available to do this automatically (though their effectiveness varies). Is that maybe what you're after? I'm not intimately familiar with any so I'll refrain from recommendations, but Google can help you in that respect. xml_pp is one option for Linux though (on Debian, I found it in the xml-twig-tools package). If you want to convert the XML to some more friendly alternative then there are some things to consider. XML can describe fairly complicated data that other text formats may not be able to do (or at least not in the same way). If the data is simple and relatively flat then you could just convert it to name=value or group+name=value, but more complicated then that and you'll be looking at a parser for the text... One advantage to XML is that it can be transformed relatively easily with XSLT. Instead of writing a Perl script, you could learn XSLT (though it's non-trivial) and just use an existing tool to transform the source XML data into whatever other format you want (for example, JSON, or Perl, or something else entirely). Unless it's really worthwhile, you might instead either edit by hand or write a tool to manipulate the XML. I suppose it depends on the complexity of the XML data you're referring to. -- Brandon McCaig <bamcc...@gmail.com> V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl. Castopulence Software <http://www.castopulence.org/> <bamcc...@castopulence.org> -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/