Narend has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I have piece of code that seems to work fine but changes some characters to entities: Example:
$labl = XML::XPath::Node::Element->new("images"); $nLabelTxt = XML::XPath::Node::Text->new($item_img); $plabel->appendChild( $nLabelTxt); $rootElm->appendChild( $labl );
generates the node as: >>>>>>>>>>>>>>>
<images> &lt;color> &lt;description>color1&lt;/description> &lt;package1>imagePath/file/filename.jpg&lt;/package1> &lt;package2>imagePath/file/filename2.jpg&lt;package2> &lt;/color> &lt;color> &lt;description>color2 &lt;/description> &lt;package1>imagePath/file/filename3.jpg&lt;/package1> &lt;package2>imagePath/file/filename52.jpg&lt;package2> &lt;/color> </images>
<<<<<<<<<<<<<<<

Which is awesome, except for the &lt; instead of < . However note that the images node is fine though!

Now, if I change to code to add another element instead of the Text->new, then I have a differen problem.

$nLabelTxt = XML::XPath::Node::Element->new($item_img);
then the output will be property with < instead of &lt;, but the elements will be like an attribute, as in:
<images> < <color> <description>color1</description> <package1>imagePath/file/filename.jpg</package1> <package2>imagePath/file/filename2.jpg</package2> </color> <color> <description>color2 </description> <package1>imagePath/file/filename3.jpg</package1> <package2>imagePath/file/filename52.jpg</package2> </color> /> </images>
Any clue & help on why this is happening? I can understand why the element being created as attribute but the first piece of code and xml it generates puzzles (pi*****) me . Thanks folks.