ID:               24474
 User updated by:  grest at interia dot pl
 Reported By:      grest at interia dot pl
-Status:           Feedback
+Status:           Open
 Bug Type:         DOM XML related
 Operating System: WinXp
 PHP Version:      4.3.2
 New Comment:

del.php
<?php
$fileName = "filmy.xml";
$fid = $HTTP_POST_VARS['deltitle'];
if(!$dom = domxml_open_file($fileName)) {
  echo "Error while parsing the document\n";
  exit;
}
$node = $dom->get_element_by_id($fid);
$parent = $node->parent_node();
$delnode = $parent->remove_child($node);
$dom->dump_file("filmy.xml", true);
$filename = "filmy.xsl";
$xmldoc = domxml_open_file("filmy.xml");
$xsldoc = domxml_xslt_stylesheet_file($filename);
$result =  $xsldoc->process($xmldoc);
print $xsldoc->result_dump_mem($result);    
?>

filmy.xml:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE LIST SYSTEM "filmy.dtd">
<LIST>
<MOVIE ID="m20036271138360">
<TITLE>13 Duchów</TITLE>
<ORGTITLE/><LOC>Grzesiek HDD</LOC>
<INFO/>
</MOVIE>
<MOVIE ID="m20036271138361">
<TITLE>8 kobiet</TITLE>
<ORGTITLE/>
<LOC>Grzesiek HDD</LOC>
<INFO/>
</MOVIE>
</LIST>

simply.html:
<html>
<body>
<form action="del.php" method="post" style="margin:0px">
<input type="hidden" name="deltitle" size="1"
value="m20036271138360"><input type="image" name="Delete"
src="del.gif">
</form>
</body>
</html>

I`m sure that 'deltitle' and $fid variable are correct "connected"
(sorry for my English :P ), but get_element_by_id doesn`t find the node
in XML file(filmy.xml)


Previous Comments:
------------------------------------------------------------------------

[2003-07-03 04:57:25] [EMAIL PROTECTED]

Please provide a FULL self-contained script which should work when we
copy and paste it into a file and run it with php <filename>. This is
useles.

------------------------------------------------------------------------

[2003-07-03 04:50:30] grest at interia dot pl

$fileName = "filmy.xml";
$fid = $HTTP_POST_VARS['deltitle'];
if(!$dom = domxml_open_file($fileName)) {
  echo "Error while parsing the document\n";
  exit;
}
$node = $dom->get_element_by_id($fid);
$parent = $node->parent_node();
$delnode = $parent->remove_child($node);
$dom->dump_file("filmy.xml", true);

------------------------------------------------------------------------

[2003-07-03 04:36:10] [EMAIL PROTECTED]

Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.


------------------------------------------------------------------------

[2003-07-03 04:33:10] grest at interia dot pl

Description:
------------
get_element_by_id doesn`t work and always returns NULL.

Reproduce code:
---------------
MY DTD:
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT LIST (MOVIE+)>
<!ELEMENT MOVIE (TITLE, ORGTITLE, LOC, INFO)>
<!ATTLIST MOVIE
        ID ID #REQUIRED
>
<!ELEMENT TITLE (#PCDATA)>
<!ELEMENT ORGTITLE (#PCDATA)>
<!ELEMENT LOC (#PCDATA)>
<!ELEMENT INFO (#PCDATA)>




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=24474&edit=1

Reply via email to