Date: 06/30/02
- Next message: mfischer <email protected>: "[PHP-DOC] Bug #18072 Updated: htmlentities() does not convert the euro-symbol () to €"
- Previous message: matslin <email protected>: "[PHP-DOC] Bug #18073: SetCookie generates error-message with empty string as parameter #3"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I have written the following code - and there is a problem. When I refer to $this->html within the function parse_xml($xml) after the xml parsing function has been called, it appears to be empty. But if I refer to it as the HTML sections are added by the xml event handlers then the content appears to be there - could you please refer me to the relevant documentation or tell me what is wrong?
<?
$me = new page_boy;
$me->parse_xml("<?xml version='1.0' ?><red>This is red</red>");
class page_boy
{
var $db_connection;
var $html;
var $interface;
var $parser;
function page_boy()
{
$this->db_connection = <email protected>("%%%%", "%%%%", "%%%%");
<email protected>("xgoat", $this->db_connection);
$this->interface = 1;
$this->html = "";
$this->parser = xml_parser_create();
xml_set_object($this->parser, &$this);
xml_set_element_handler($this->parser, "start_tag", "end_tag");
xml_set_character_data_handler($this->parser, "cdata");
}
function parse_xml($xml)
{
xml_parse($this->parser, $xml);
echo $this->html;
}
function start_tag($r_parser, $tagname, $tag_att)
{
$qre = mysql_query("SELECT content FROM tags WHERE mode = $this->interface
AND type = 'open'
AND name = '$tagname'", $this->db_connection);
$r_arr = mysql_fetch_array($qre);
$this->add_content($r_arr["content"]);
}
function end_tag($r_parser, $tagname)
{
$qre = mysql_query("SELECT content FROM tags WHERE mode = $this->interface
AND type = 'close'
AND name = '$tagname'", $this->db_connection);
$r_arr = mysql_fetch_array($qre);
$this->add_content($r_arr["content"]);
}
function cdata($r_parser, $cdata)
{
$this->add_content($cdata);
}
function add_content($ncnt)
{
$this->html = $this->html . $ncnt;
echo $ncnt;
}
}
?>
- Next message: mfischer <email protected>: "[PHP-DOC] Bug #18072 Updated: htmlentities() does not convert the euro-symbol () to €"
- Previous message: matslin <email protected>: "[PHP-DOC] Bug #18073: SetCookie generates error-message with empty string as parameter #3"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

