parent_element = $this->current_element; $this->current_element = $name; switch($name) { case "XBEL": // Begin the file $this->Output .= "\n"; break; case "METADATA": break; case "INFO": break; case "DESC": break; case "TITLE": if ("XBEL" != $this->parent_element && "BOOKMARK" != $this->parent_element) $this->Output .= "
  • foldercount."\" style=\"display: none\">"; break; } $this->current_element = $this->parent_element; } // Constructor. Pass it a filename. function expatXBEL($filename) { if($this->_xbelfile = @file($filename, 1)){ $this->xml_parser = xml_parser_create(); xml_set_object($this->xml_parser, $this); xml_parser_set_option($this->xml_parser, XML_OPTION_CASE_FOLDING, true); xml_parser_set_option($this->xml_parser, XML_OPTION_TARGET_ENCODING, 'UTF-8'); xml_set_element_handler($this->xml_parser, "startElement", "endElement"); xml_set_character_data_handler($this->xml_parser, "characterData"); return $this->parse(); } else { $this->Error = 'Could not download XBEL file. Please configure the URL.'; return false; } } function parse() { if(!count($this->_xbelfile)){ $this->Error = "Empty or missing XBEL file."; return false; } else { while(list($line_num, $line) = each($this->_xbelfile)) { if(!xml_parse($this->xml_parser, ereg_replace('&', '&', $line))) { $this->Error = "on line:" . $line_num ." ". xml_error_string(xml_get_error_code($this->xml_parser)); return false; } } xml_parser_free($this->xml_parser); unset($this->_xbelfile); } return true; } } /* End of expatXBEL class */ ?> XBEL Bookmarks

    Set URL of the XBEL file

    XBEL Bookmarks help

    Error) { // Collapse / Expand links echo "

    \n
    \nCollapse all | Expand all\n

    \n"; // Title if available if ($xbel->Title) echo "

    \n".$xbel->Title.":\n

    "; // Sort out the character encoding $xbel->Output = utf8_decode($xbel->Output); // Print the bookmarks echo $xbel->Output; } else { echo "

    ".$xbel->Error."

    "; } ?>