我有大約8000個需要轉換爲文本文件的xml文件。文本文件必須包含xml文件的標題,描述和關鍵字,而不包含標籤,並且還要刪除其他元素和屬性。換句話說,我需要創建8000個文本文件,其中包含XML文件的標題,描述和關鍵字。我需要系統地編寫這些代碼。任何幫助將不勝感激。提前致謝。如何將Xml文件轉換爲文本文件2
嘿,大家都非常感謝你的回覆。 這裏是什麼我的XML看起來像一個示例:
<?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>
,這將是輸出:
烏納晚報EN EL cementerio(恐怖)在墓地
夜
夜,在,墓地,43,製作
這需要保存爲相同的名稱,但文本格式。非常感謝,如果有更多的建議,將不勝感激。
不需要兩個單獨的問題。 http://stackoverflow.com/questions/2941264/how-to-convert-xml-files-to-text-files – 2010-05-31 05:31:21