发新话题
打印

如何用PHP把RDF内容插入Web站点之中(3)

如何用PHP把RDF内容插入Web站点之中(3)

}
}

// destroy parser
xml_parser_free($xp),

// opening tag handler
function elementBegin($parser, $name, $attributes)
{
global $currentTag, $flag,
// export the name of the current tag to the global scope
$currentTag = $name,
// if within an item block, set a flag
if ($name == "ITEM")
{
$flag = 1,
}
}

// closing tag handler
function elementEnd($parser, $name)
{
global $currentTag, $flag,
$currentTag = "",
// if exiting an item block, print a line and reset the flag
if ($name == "ITEM")
{
echo "<hr>",
$flag = 0,
}
}

// character data handler
function characterData($parser, $data)
{
global $currentTag, $flag,
// if within an item block, print item data
if (($currentTag == "TITLE" || $currentTag == "LINK" ||
$currentTag ==
"DESCRIPTION")

TOP

发新话题