/usr/share/doc/sgmls-doc/sgmlspl/generic.html is in sgmls-doc 1.03ii-33.
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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | <HTML>
<HEAD>
<TITLE>What are the generic events?</TITLE>
</HEAD>
<BODY>
<P><B>Links</B>: <A HREF=specific.html>Next</A> <A HREF=handlers.html>Previous</A> <A HREF=sgmlspl.html>Up</A> <A HREF=sgmlspl.html>Top</A></P>
<H1>What are the generic events?</H1>
<P><A HREF=sgmlspl.html><TT>sgmlspl</TT></A> recognises the twelve generic events listed in table
1. You may provide any one of these
as the first argument to <TT>sgml</TT> to declare a handler
(string or subroutine) for that event.</P>
<H3>Table 1: <A HREF=sgmlspl.html><TT>sgmlspl</TT></A> generic events</H3>
<HR>
<DL>
<DT><B>Event</B></DT>
<DD><TT>'start'</TT></DD>
<DT><B>Description</B></DT>
<DD>Execute <IT>handler</IT> (with no arguments) at
the beginning of the parse.</DD>
</DL>
<HR>
<DL>
<DT><B>Event</B></DT>
<DD><TT>'end'</TT></DD>
<DT><B>Description</B></DT>
<DD>Execute <IT>handler</IT> (with no arguments) at
the end of the parse.</DD>
</DL>
<HR>
<DL>
<DT><B>Event</B></DT>
<DD><TT>'start_element'</TT></DD>
<DT><B>Description</B></DT>
<DD>Execute <IT>handler</IT> at the beginning of every
element without a specific start handler.</DD>
</DL>
<HR>
<DL>
<DT><B>Event</B></DT>
<DD><TT>'end_element'</TT></DD>
<DT><B>Description</B></DT>
<DD>Execute <IT>handler</IT> at the end of every
element without a specific end handler.</DD>
</DL>
<HR>
<DL>
<DT><B>Event</B></DT>
<DD><TT>'cdata'</TT></DD>
<DT><B>Description</B></DT>
<DD>Execute <IT>handler</IT> for every character-data
string.</DD>
</DL>
<HR>
<DL>
<DT><B>Event</B></DT>
<DD><TT>'sdata'</TT></DD>
<DT><B>Description</B></DT>
<DD>Execute <IT>handler</IT> for every special-data
string without a specific handler.</DD>
</DL>
<HR>
<DL>
<DT><B>Event</B></DT>
<DD><TT>'re'</TT></DD>
<DT><B>Description</B></DT>
<DD>Execute <IT>handler</IT> for every
record end.</DD>
</DL>
<HR>
<DL>
<DT><B>Event</B></DT>
<DD><TT>'pi'</TT></DD>
<DT><B>Description</B></DT>
<DD>Execute <IT>handler</IT> for every processing
instruction.</DD>
</DL>
<HR>
<DL>
<DT><B>Event</B></DT>
<DD><TT>'entity'</TT></DD>
<DT><B>Description</B></DT>
<DD>Execute <IT>handler</IT> for every external data
entity without a specific handler.</DD>
</DL>
<HR>
<DL>
<DT><B>Event</B></DT>
<DD><TT>'start_subdoc'</TT></DD>
<DT><B>Description</B></DT>
<DD>Execute <IT>handler</IT> at the beginning of every
subdocument entity without a specific handler.</DD>
</DL>
<HR>
<DL>
<DT><B>Event</B></DT>
<DD><TT>'end_subdoc'</TT></DD>
<DT><B>Description</B></DT>
<DD>Execute <IT>handler</IT> at the end of every
subdocument entity without a specific handler.</DD>
</DL>
<HR>
<DL>
<DT><B>Event</B></DT>
<DD><TT>'conforming'</TT></DD>
<DT><B>Description</B></DT>
<DD>Execute <IT>handler</IT> once, at the end of the
document parse, if and only if the document was conforming.</DD>
</DL>
<HR>
<P>The handlers for all of these except the document events
<TT>'start'</TT> and <TT>'end'</TT> will receive
two arguments whenever they are called: the first will be the data
associated with the event (if any), and the second will be the
<TT>SGMLS_Event</TT> object itself (see the document for
<A HREF="../SGMLSpm/sgmlspm.html"><TT>SGMLS.pm</TT></A>). Note the following example, which allows processing
instructions for including the date or the hostname in the document at
parse time:</P>
<P>
<PRE>sgml('pi', sub {
my ($instruction) = @_;
if ($instruction eq 'date') {
output `date`;
} elsif ($instruction eq 'hostname') {
output `hostname`;
} else {
print STDERR "Warning: unknown processing instruction: $instruction\n";
}
});</PRE>
</P>
<P>With this <A HREF=handlers.html>handler</A>, any occurance
of <TT><?date></TT> in the original <A HREF="http://www.sil.org/sgml/sgml.html"><B>SGML</B></A> document
would be replaced by the current date and time, and any occurance of
<TT><?hostname></TT> would be replaced by the name of
the host.</P>
<P><B>Links</B>: <A HREF=specific.html>Next</A> <A HREF=handlers.html>Previous</A> <A HREF=sgmlspl.html>Up</A> <A HREF=sgmlspl.html>Top</A></P>
<ADDRESS>David Megginson <A HREF="mailto:dmeggins@aix1.uottawa.ca"><dmeggins@aix1.uottawa.ca></A></ADDRESS>
</BODY>
</HTML>
|