Hi Monks,

I don't understand why I got this error message: "xmlXPathCompiledEval: 1 object left on the stack".
Does anybody know why I go this error message?

Here my code and the data but I think you need to create an XML file call "coffe" or whatever you like to run the code:
use XML::LibXML; use CGI ':standard'; use warnings; use strict; #Variables my $newval; my $categor = 'Coffee'; my $oldval; my $prod = '801.55.01'; my $cats; my $success; print header; if ($categor eq 'Coffee') { $cats = 'C:\Program Files\Apache Group\Apache2\htdocs\lega +stronome\XML\admin\coffee.xml'; } else { print "Sorry the category that you wanted to edited doesn' +t exist. Please contact your administrator. \n Thanks"; exit 1; } my $cat = $cats; my $parser = XML::LibXML->new(); my $d = $parser->parse_file(join "", $cat); for my $dead ($d->findnodes(q{/category/subcategory/product[product_id + = $prod]})) { $dead->unbindNode; $success = 1; } if ($success eq 1) { print "<html><head></head>\n"; print "<body>\n"; print "<p>Test</p>\n"; print "<p><h1>Done for</h1></p>\n"; print "<br\>\n"; print "<br><br><a href=\'javascript:window.close();\'>Close this w +indow </a>\n"; #$d->toFile($cat); print $d->toString; print"<br><h3>All done!</h3>"; print "</body></html>\n"; exit 1; } else { print "<html><head></head>\n"; print "<body>\n"; print "<p>Fail!!</p>\n"; print "<br\>\n"; print "<br><br><a href=\'javascript:window.close();\'>Close this w +indow </a>\n"; print "</body></html>"; } __DATA__ <category name="Coffee"> <heading>150 years of know how at the service of a same strategy: Ta +ste</heading> <photo>images/bag_legal.jpg</photo> <subcategory name="Prestige"> <photo>images/prestige.jpg</photo> <product>Coffee <brand>Legal</brand> <channel>D</channel> <channel>A</channel> <conditionning unit="gr">250</conditionning> <description>Legal Prestige</description> <packaging_qty>12</packaging_qty> <product_id>800.55.01</product_id> <recipe>/recipes/coffee1.html</recipe> </product> <product>Coffee <brand>Legal</brand> <channel>D</channel> <channel>A</channel> <conditionning unit="gr">500</conditionning> <description>Legal Prestige Boite Arôme</description> <packaging_qty>6</packaging_qty> <product_id>801.55.01</product_id> </product> </subcategory> </category>

Thanks,
Maxim

In reply to 1 object left on the stack by Maxim

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.