<?xml version="1.0" encoding="windows-1252"?>
<node id="1005274" title="Re: input &amp; output for TB conv" created="2012-11-23 09:52:12" updated="2012-11-23 09:52:12">
<type id="11">
note</type>
<author id="533863">
roboticus</author>
<data>
<field name="doctext">
&lt;p&gt;[satheeshbssb]:&lt;/p&gt;
&lt;p&gt;I was able to turn your HTML table into a valid&lt;sup&gt;&amp;#91;1&amp;#93;&lt;/sup&gt; XML table simply by prefixing it with:
&lt;c&gt;
&lt;?xml version="1.0"?&gt;
&lt;/c&gt;
&lt;p&gt;On a more serious note: You don't really provide a lot of information about what you're doing, so my joke answer above is an accurate-enough answer to your question.&lt;/p&gt;
&lt;p&gt;However, what I think you want is to break your table up into more than a single cell.  For that, you're going to need to figure out how to (a) break your text up into records, and (b) split the records into fields.&lt;/p&gt;
&lt;p&gt;If we ignore your header, it looks like your table data is a single line per record, so you can use a typical loop to read it record by record:&lt;/p&gt;
&lt;c&gt;
while (my $record = &lt;$FH&gt;) {
   ... process each record ...
}
&lt;/c&gt;
&lt;p&gt;And your first two fields appear to be single words.  So you could use a [doc://perlre|regular expression] or [doc://split|some] [doc://substr|other] [doc://unpack|method] to split your records up into the individual fields.&lt;/p&gt;
&lt;p&gt;Finally, to turn your data into XML, you would be well served to go to CPAN and look for some [cpan://XML::Writer|module to write XML], to make sure you don't make "fake" XML files (of which the world sees too many).&lt;/p&gt;
&lt;p&gt;&amp;#91;1&amp;#93; as verified by [http://validator.w3.org/check|the w3 org xml validator].&lt;/p&gt;
&lt;p&gt;...[roboticus]&lt;/p&gt;
&lt;p&gt;&lt;i&gt;When your only tool is a hammer, all problems look like your thumb.&lt;/i&gt;&lt;/p&gt;</field>
<field name="root_node">
1005258</field>
<field name="parent_node">
1005258</field>
</data>
</node>
