Narend has asked for the wisdom of the Perl Monks concerning the following question:
generates the node as: >>>>>>>>>>>>>>>$labl = XML::XPath::Node::Element->new("images"); $nLabelTxt = XML::XPath::Node::Text->new($item_img); $plabel->appendChild( $nLabelTxt); $rootElm->appendChild( $labl );
<<<<<<<<<<<<<<<<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>
Which is awesome, except for the < 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.
then the output will be property with < instead of <, but the elements will be like an attribute, as in:$nLabelTxt = XML::XPath::Node::Element->new($item_img);
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.<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>
|
|---|