Hi the_r,

First, have a look at the documentation, and note that XML::LibXML->load_xml(string=>$fileName); is trying to parse the string contained in $fileName. What you want is XML::LibXML->load_xml(location=>$fileName); instead.

Will the XML:LibXML handle any type of file or does it strictly need a xml file?

It will need an XML file conforming to the specifications. I am having trouble understanding the sample data you posted, please use <code> tags. Is this all one file, or three separate files? If the latter, then the above change should be all you need.

If however the input you pasted here is from one single file (as you seem to be saying with the "log file"), then this is not a standard XML file, as the <?xml...?> declaration may only appear once, at the top of the file. First, I would recommend you check the source of the data, whether you can retrieve the pieces of XML as individual files. If not, I might complain to whomever is generating this data that it does not conform to XML specifications :-)

If that doesn't work, you may be left with parsing the file and breaking it into individual chunks that a normal XML parser can handle, in that case, you'll have to show a sample input that is representative of the data you're getting, in <code> tags. But try and see if you can get data conforming to the standards first.

Hope this helps,
-- Hauke D


In reply to Re^3: Retrieving XML From a File Based On Child Node Attribute by haukex
in thread Retrieving XML From a File Based On Child Node Attribute by the_r

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.