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


In reply to how to strip XML into Plain Text file by dbrock

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.