How to convert Xml files to Text Files 2

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-05-31T05:27:19Z Indexed on 2010/05/31 5:32 UTC
Read the original article Hit count: 212

Filed under:
|
|
|

Hi all, I have around 8000 xml files that needs to be converted into text files. The text file must contain title, description and keywords of the xml file without the tags and removing other elements and attributes as well. In other words, i need to create 8000 text files containing the title,description and keywords of the xml file. I need codings for this to be done systematically. Any help would be greatly appreciated. Thanks in advance.

Hey all thank you all so so much with your replies. Here's a sample of what my xml looks like:

<?xml version="1.0"?>
<metadata>
<identifier>43productionsNightatthegraveyard</identifier>

<title>Night at the graveyard</title>

<collection>opensource_movies</collection>
<mediatype>movies</mediatype>
<resource>movies</resource>
<upload_application appid="ccPublisher" version="2.2.1"/>
<uploader>[email protected]</uploader>

<description>una noche en el cementerio (terror)</description>

<license>http://creativecommons.org/licenses/by-nc/3.0/</license>
<title>Night at the graveyard</title>
  <format>Video</format>
<adder>[email protected]</adder>
<licenseurl>http://creativecommons.org/licenses/by-nc/3.0/</licenseurl>
<year>2007</year>

<keywords>Night,at,the,graveyard,43,productions</keywords>

<holder>43 productions</holder>
<publicdate>2007-04-11 19:52:28</publicdate>
</metadata>

And this would be the output:

una noche en el cementerio (terror)

Night at the graveyard

Night,at,the,graveyard,43,productions

This need to be saved with the same name but in text format. Thanks all so much if any more suggestions would be much appreciated.

© Stack Overflow or respective owner

Related posts about Xml

Related posts about text