/usr/share/doc/php-xml-htmlsax3/examples/SimpleExample.php is in php-xml-htmlsax3 3.0.0+really3.0.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | <?php
/***
* $Id: SimpleExample.php,v 1.3 2004/06/02 14:33:38 hfuecks Exp $
* Shows all the handlers in use with a simple document
*/
require_once('XML/HTMLSax3.php');
class MyHandler {
function MyHandler(){}
function openHandler(& $parser,$name,$attrs) {
echo ( 'Open Tag Handler: '.$name.'<br />' );
echo ( 'Attrs:<pre>' );
print_r($attrs);
echo ( '</pre>' );
}
function closeHandler(& $parser,$name) {
echo ( 'Close Tag Handler: '.$name.'<br />' );
}
function dataHandler(& $parser,$data) {
echo ( 'Data Handler: '.$data.'<br />' );
}
function escapeHandler(& $parser,$data) {
echo ( 'Escape Handler: '.$data.'<br />' );
}
function piHandler(& $parser,$target,$data) {
echo ( 'PI Handler: '.$target.' - '.$data.'<br />' );
}
function jaspHandler(& $parser,$data) {
echo ( 'Jasp Handler: '.$data.'<br />' );
}
}
$doc=<<<EOD
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>HTML Sax in Action</title>
<meta name="Description" content="Example for HTML Sax">
<!-- Some JavaScript inside a CDATA block coming right up... -->
<script type="application/x-javascript">
<![CDATA[
document.write('<b>Hello World!</b>');
]]>
</script>
</head>
<body>
<?php
echo ( '<b>This is a processing instruction</b>' );
?>
<a href="http://www.php.net">PHP</a>
<%
document.write('<i>Hello World!</i>');
%>
</body>
</html>
EOD;
// Instantiate the handler
$handler=new MyHandler();
// Instantiate the parser
$parser=& new XML_HTMLSax3();
// Register the handler with the parser
$parser->set_object($handler);
// Set a parser option
$parser->set_option('XML_OPTION_TRIM_DATA_NODES');
// Set the handlers
$parser->set_element_handler('openHandler','closeHandler');
$parser->set_data_handler('dataHandler');
$parser->set_escape_handler('escapeHandler');
$parser->set_pi_handler('piHandler');
$parser->set_jasp_handler('jaspHandler');
// Parse the document
$parser->parse($doc);
?>
|