function toc($file) { global $handle, $html_handle; global $files; $tags = array("para"); $child_tags = array("ulink"); $parser = new XML_PullParser($file, $tags, $child_tags); $next_url = ""; $prev_url = ""; while ($token = $parser->XML_PullParser_getToken()) { if ($link = $parser->XML_PullParser_getElement('ulink')) { while ($link = $parser->XML_PullParser_nextElement()) { $url_array = $parser->XML_PullParser_getAttributes($link); $url = $parser->XML_PullParser_getAttrVal('url', $url_array); $link_text = trim($parser->XML_PullParser_getText($link)); $type = $parser->XML_PullParser_getAttrVal('type', $url_array); if ($type == "next") { echo "<A href=\"article2html.php?fn={$url}\">{$link_text}</A><br>\n"; writeEntry($handle, "{$url}", $link_text); writeHTMLEntry($html_handle, "{$url}", $link_text); $next_url = $url; $files[$next_url] = true; } if ($type == "prev") { // echo "Prev: $link_text\n"; } } } } $parser->XML_PullParser_free(); return $next_url; }
$citation_str .= formatSectionCitations($file_names[$index]); } writeEntry($handle, "XML_PullParser" . $fn, $citation_str, "function"); } writeText($handle, "</indexdiv>\n"); writeText($handle, "<formalpara><title></title><para><![CDATA[ <BR /> ]]></para></formalpara>"); writeText($handle, "\n<indexdiv><title>Index of Variables and Terms</title>\n"); ksort($glossary); foreach ($glossary as $term => $val) { $val = array_unique($val); $citation_str = ""; foreach ($val as $index) { $citation_str .= formatSectionCitations($file_names[$index]); } $citation_str = rtrim($citation_str, ','); writeEntry($handle, $term, $citation_str, "varname"); } writeText($handle, "</indexdiv>"); writeFooter($handle); // -------------------END MAIN ------------------------- function get_array() { XML_PullParser_excludeBlanks(true); XML_PullParser_trimCdata(true); global $doc, $fn_names; $tags = array("simplelist"); $child_tags = array('member'); $parser = new XML_PullParser_doc($doc, $tags, $child_tags); while ($token = $parser->XML_PullParser_getToken()) { $parser->XML_PullParser_getElement('member'); $which = 1;