http://qs1969.pair.com?node_id=425049

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

Hello...

I have an XML file that I am trying to strip back into plain text... Listed Below is an excerpt of the XML data...

I am trying to use something like s/\<.+\>//; to remove all of the the text contained within the < > brackets... The file does not seem to open correctly...

Any advice...?



<?xml version="1.0" encoding="UTF-16"?> <joblog><job_log_version version="1.0"/> <header><filler> ====================================================================== </filler><server>Job server: computername </server><name>Job name: computername - Inc </name><start_time>Job started: Monday, December 27, 2004 at 2:53:38 PM </start_time><type>Job type: Backup </type><log_name>Job Log: BEX00164.xml </log_name><filler> ====================================================================== </filler></header><media_drive_and_media_info> Drive and media information from media mount: <robotic_library_name>Robotic Library Name: COMPAQ 1 </robotic_library_name><drive_name>Drive Name: COMPAQ 1 </drive_name><slot>Slot: 1 </slot><media_label>Media Label: DSW000 </media_label><media_guid>Media GUID: {431B03DE-1C49-11D4-B21C-00508BCA3A68} </media_guid><media_overwrite_date>Overwrite Protected Until: 1/30/2005 3:14:41 AM </media_overwrite_date><media_append_date>Appendable Until: 12/31/9999 12:00:00 AM </media_append_date><media_set_target>Targeted Media Set Name: Daily </media_set_target></media_drive_and_media_info><backup><filler> ====================================================================== </filler><title>Job Operation - Backup </title><append_or_overwrite>Media operation - append. </append_or_overwrite><compression>Hardware compression enabled. </compression><filler>



I want the output to look like this





====================================================================== Job server: computername Job name: computername - Inc Job started: Monday, December 27, 2004 at 2:53:38 PM Job type: Backup Job Log: BEX00164.xml ====================================================================== Drive and media information from media mount: Robotic Library Name: COMPAQ 1 Drive Name: COMPAQ 1 Slot: 1 Media Label: DSW000 Media GUID: {431B03DE-1C49-11D4-B21C-00508BCA3A68} Overwrite Protected Until: 1/30/2005 3:14:41 AM Appendable Until: 12/31/9999 12:00:00 AM Targeted Media Set Name: Daily ====================================================================== Job Operation - Backup Media operation - append. Hardware compression enabled. ======================================================================


Thank you for any help...
DBrock...

Dozens of br tags throughout input/output examples replaced by a set of code tags, to eliminate issues with long-line horizontal scrolling, by davido.
Edit by castaway - HTML entities turned back into literal characters, to make sense with code tags