Search code examples
xmlperlxmlwriter

Perl XML::Writer prints bad character


I am using XML::Writer and I have this code:

foreach $param (@{$fce->{"params"}}){
  $i++;
  print $param . ",";
  $writer->emptyTag( 'param', number => $i, type => $param );
}

This is output of XML::Writer:

<param number="1" type="const enum eDebugLevels" />
<param number="2" type="const char   &#9;&#9;*  const" />

But output of that print is:

const enum eDebugLevels,const char       *  const,

Why are there the &#9;? I really don't want them (and I need spaces to stay as they are). Thank you


Solution

  • &#9; is a tab, so for any XML parser "const char &#9;&#9;* const" will be parsed as "const char \t\t* const". If you have a problem with tabs, then you need to pre-process your output, it's not XML::Writer's job to do this.