| 1 | <HTML> |
| 2 | <HEAD> |
| 3 | <TITLE>What are the specific events?</TITLE> |
| 4 | </HEAD> |
| 5 | <BODY> |
| 6 | |
| 7 | <P><B>Links</B>: <A HREF=output.html>Next</A> <A HREF=generic.html>Previous</A> <A HREF=sgmlspl.html>Up</A> <A HREF=sgmlspl.html>Top</A></P> |
| 8 | |
| 9 | <H1>What are the specific events?</H1> |
| 10 | |
| 11 | <P>In addition to the <A HREF=generic.html>generic |
| 12 | events</A> listed in the previous section, <A HREF=sgmlspl.html><TT>sgmlspl</TT></A> allows |
| 13 | special, specific handlers for the beginning and end of elements and |
| 14 | subdocument entities, for SDATA strings, and for external data |
| 15 | entities. Table 2 lists the |
| 16 | different specific event types available.</P> |
| 17 | |
| 18 | |
| 19 | <H3>Table 2: Specific event types</H3> |
| 20 | |
| 21 | <HR> |
| 22 | <DL> |
| 23 | <DT><B>Event</B></DT> |
| 24 | <DD><TT>'<GI>'</TT></DD> |
| 25 | <DT><B>Description</B></DT> |
| 26 | <DD>Execute <IT>handler</IT> at the beginning of |
| 27 | every element named <TT>'GI'</TT>.</DD> |
| 28 | |
| 29 | </DL> |
| 30 | <HR> |
| 31 | |
| 32 | |
| 33 | <DL> |
| 34 | <DT><B>Event</B></DT> |
| 35 | <DD><TT>'</GI>'</TT></DD> |
| 36 | <DT><B>Description</B></DT> |
| 37 | <DD>Execute <IT>handler</IT> at the end of every |
| 38 | element named <TT>'GI'</TT>.</DD> |
| 39 | |
| 40 | </DL> |
| 41 | <HR> |
| 42 | |
| 43 | |
| 44 | <DL> |
| 45 | <DT><B>Event</B></DT> |
| 46 | <DD><TT>'|SDATA|'</TT></DD> |
| 47 | <DT><B>Description</B></DT> |
| 48 | <DD>Execute <IT>handler</IT> for every special-data |
| 49 | string <TT>'SDATA'</TT>.</DD> |
| 50 | |
| 51 | </DL> |
| 52 | <HR> |
| 53 | |
| 54 | |
| 55 | <DL> |
| 56 | <DT><B>Event</B></DT> |
| 57 | <DD><TT>'&ENTITY;'</TT></DD> |
| 58 | <DT><B>Description</B></DT> |
| 59 | <DD>Execute <IT>handler</IT> for every external data |
| 60 | entity named <TT>'ENTITY'</TT>.</DD> |
| 61 | |
| 62 | </DL> |
| 63 | <HR> |
| 64 | |
| 65 | |
| 66 | <DL> |
| 67 | <DT><B>Event</B></DT> |
| 68 | <DD><TT>'{ENTITY}'</TT></DD> |
| 69 | <DT><B>Description</B></DT> |
| 70 | <DD>Execute <IT>handler</IT> at the beginning of |
| 71 | every subdocument entity named <TT>'ENTITY'</TT>.</DD> |
| 72 | |
| 73 | </DL> |
| 74 | <HR> |
| 75 | |
| 76 | |
| 77 | <DL> |
| 78 | <DT><B>Event</B></DT> |
| 79 | <DD><TT>'{/ENTITY}'</TT></DD> |
| 80 | <DT><B>Description</B></DT> |
| 81 | <DD>Execute <IT>handler</IT> at the end of every |
| 82 | subdocument entity named <TT>'ENTITY'</TT>.</DD> |
| 83 | |
| 84 | </DL> |
| 85 | <HR> |
| 86 | |
| 87 | |
| 88 | <P>Note that these override the <A HREF=generic.html>generic-event</A> handlers. For example, if you |
| 89 | were to type</P> |
| 90 | |
| 91 | <P> |
| 92 | <PRE>sgml('&FOO;', sub { |
| 93 | output "Found a \"foo\" entity!\n"; |
| 94 | }); |
| 95 | |
| 96 | sgml('entity', sub { |
| 97 | output "Found an entity!\n"; |
| 98 | });</PRE> |
| 99 | </P> |
| 100 | <P>And the external data entity <TT>&FOO;</TT> |
| 101 | appeared in your <A HREF="http://www.sil.org/sgml/sgml.html"><B>SGML</B></A> document, <A HREF=sgmlspl.html><TT>sgmlspl</TT></A> would call the first |
| 102 | handler rather than the second.</P> |
| 103 | |
| 104 | <P>Note also that start and end handlers are entirely separate |
| 105 | things: if an element has a specific start handler but no specific end |
| 106 | handler, the generic end handler will still be called at the end of |
| 107 | the element. To prevent this, declare a handler with an empty string:</P> |
| 108 | |
| 109 | <P> |
| 110 | <PRE>sgml('</HACK>', '');</PRE> |
| 111 | </P> |
| 112 | |
| 113 | <P><B>Links</B>: <A HREF=output.html>Next</A> <A HREF=generic.html>Previous</A> <A HREF=sgmlspl.html>Up</A> <A HREF=sgmlspl.html>Top</A></P> |
| 114 | |
| 115 | |
| 116 | <ADDRESS>David Megginson <A HREF="mailto:[email protected]"><[email protected]></A></ADDRESS> |
| 117 | </BODY> |
| 118 | </HTML> |