Hi Marto, the source data is XML with TT instructions in the file.

The XML is intended to create and XLS file.Below is an extract

<?xml version="1.0" encoding="ISO-8859-1"?> <workbook> <worksheet name="[% config.template %]"><format color="black"> [% FOREACH host IN hosts %] <row><bold><format color="white" size="14" bg_color="blue"><cell w +idth="60" text="Configuring de : [% host.name %]" /></format></bold>< +/row> <row /> [% FOREACH int IN host.interfaces %] <row><cell text="interface ip-bundle [% int.bundle %].[% int.subBu +ndle %]" /></row> [% FOREACH ip IN int.secondaries %] <row><cell text=" ip address [% ip.ipAddress %] [% ip.subnetMask % +] [% bits(ip.ipAddress,ip.subnetMask) %] secondary" /></row> [% END %] <row><cell text="!"/></row> [% END %] <row /> <row><bold><format color="white" size="14" bg_color="blue"><cell t +ext="END OF : [% host.name %]" /></format></bold></row> <row /><row /><row /> [% END %] </format> </worksheet> </workbook>
So what I want to do, is extract both "cell text" and TT instructions to recreate the content in HTML format. Problem is, how should I parse the file so that I can retrieve XML with XML::LibXML & TT instruction lines at the same time ? Like I said, my objective is to display the template to the users. Creating the XLS file is not a problem. I want to show network engineers how the template is built without giving access to the .tt file.

In reply to Re^2: XML Parsing in a "mixed content" file by llarochelle
in thread XML Parsing in a "mixed content" file by llarochelle

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.