File: specific.html

package info (click to toggle)
libsgmls-perl 1.03ii-38
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 900 kB
  • sloc: perl: 1,387; lisp: 262; makefile: 130
file content (118 lines) | stat: -rw-r--r-- 2,901 bytes parent folder | download | duplicates (9)
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
<HTML>
<HEAD>
<TITLE>What are the specific events?</TITLE>
</HEAD>
<BODY>

<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>

<H1>What are the specific events?</H1>

<P>In addition to the <A HREF=generic.html>generic
events</A> listed in the previous section, <A HREF=sgmlspl.html><TT>sgmlspl</TT></A> allows
special, specific handlers for the beginning and end of elements and
subdocument entities, for SDATA strings, and for external data
entities.  Table 2 lists the
different specific event types available.</P>


<H3>Table 2: Specific event types</H3>

<HR>
<DL>
<DT><B>Event</B></DT>
<DD><TT>'&lt;GI&gt;'</TT></DD>
<DT><B>Description</B></DT>
<DD>Execute <IT>handler</IT> at the beginning of
every element named <TT>'GI'</TT>.</DD>

</DL>
<HR>


<DL>
<DT><B>Event</B></DT>
<DD><TT>'&lt;/GI&gt;'</TT></DD>
<DT><B>Description</B></DT>
<DD>Execute <IT>handler</IT> at the end of every
element named <TT>'GI'</TT>.</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 <TT>'SDATA'</TT>.</DD>

</DL>
<HR>


<DL>
<DT><B>Event</B></DT>
<DD><TT>'&amp;ENTITY;'</TT></DD>
<DT><B>Description</B></DT>
<DD>Execute <IT>handler</IT> for every external data
entity named <TT>'ENTITY'</TT>.</DD>

</DL>
<HR>


<DL>
<DT><B>Event</B></DT>
<DD><TT>'{ENTITY}'</TT></DD>
<DT><B>Description</B></DT>
<DD>Execute <IT>handler</IT> at the beginning of
every subdocument entity named <TT>'ENTITY'</TT>.</DD>

</DL>
<HR>


<DL>
<DT><B>Event</B></DT>
<DD><TT>'{/ENTITY}'</TT></DD>
<DT><B>Description</B></DT>
<DD>Execute <IT>handler</IT> at the end of every
subdocument entity named <TT>'ENTITY'</TT>.</DD>

</DL>
<HR>


<P>Note that these override the <A HREF=generic.html>generic-event</A> handlers.  For example, if you
were to type</P>

<P>
<PRE>sgml('&amp;FOO;', sub {
    output "Found a \"foo\" entity!\n";
});

sgml('entity', sub {
    output "Found an entity!\n";
});</PRE>
</P>
<P>And the external data entity <TT>&amp;FOO;</TT>
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
handler rather than the second.</P>

<P>Note also that start and end handlers are entirely separate
things: if an element has a specific start handler but no specific end
handler, the generic end handler will still be called at the end of
the element.  To prevent this, declare a handler with an empty string:</P>

<P>
<PRE>sgml('&lt;/HACK&gt;', '');</PRE>
</P>

<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>


<ADDRESS>David Megginson <A HREF="mailto:dmeggins@aix1.uottawa.ca">&lt;dmeggins@aix1.uottawa.ca&gt;</A></ADDRESS>
</BODY>
</HTML>