The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
<HTML>
<HEAD>
<TITLE>What are the different event types and data?</TITLE>
</HEAD>
<BODY>

<P><B>Links</B>: <A HREF=sgmlselement.html>Next</A> <A HREF=sgmlsevent.html>Previous</A> <A HREF=sgmlspm.html>Up</A> <A HREF=sgmlspm.html>Top</A></P>

<H1>What are the different event types and data?</H1>

<P>Table 2 lists the ten
different event types returned by the <TT>next_event</TT>
method of an <A HREF=sgmls.html><TT>SGMLS</TT></A>
object and the different types of data associated with each of these
(note that these do <EM>not</EM> correspond to the
standard <B>ESIS</B> events).</P>


<H3>Table 2: The <TT>SGMLS_Event</TT> types</H3>

<HR>
<DL>
<DT><B>Event Type</B></DT>
<DD><TT>'start_element'</TT></DD>
<DT><B>Event Data</B></DT>
<DD><TT>SGMLS_Element</TT></DD>
<DT><B>Description</B></DT>
<DD>The beginning of an element.</DD>

</DL>
<HR>


<DL>
<DT><B>Event Type</B></DT>
<DD><TT>'end_element'</TT></DD>
<DT><B>Event Data</B></DT>
<DD><TT>SGMLS_Element</TT></DD>
<DT><B>Description</B></DT>
<DD>The end of an element.</DD>

</DL>
<HR>


<DL>
<DT><B>Event Type</B></DT>
<DD><TT>'cdata'</TT></DD>
<DT><B>Event Data</B></DT>
<DD>string</DD>
<DT><B>Description</B></DT>
<DD>Regular character data.</DD>

</DL>
<HR>


<DL>
<DT><B>Event Type</B></DT>
<DD><TT>'sdata'</TT></DD>
<DT><B>Event Data</B></DT>
<DD>string</DD>
<DT><B>Description</B></DT>
<DD>Special system data.</DD>

</DL>
<HR>


<DL>
<DT><B>Event Type</B></DT>
<DD><TT>'re'</TT></DD>
<DT><B>Event Data</B></DT>
<DD>[none]</DD>
<DT><B>Description</B></DT>
<DD>A record-end (i.e., a newline).</DD>

</DL>
<HR>


<DL>
<DT><B>Event Type</B></DT>
<DD><TT>'pi'</TT></DD>
<DT><B>Event Data</B></DT>
<DD>string</DD>
<DT><B>Description</B></DT>
<DD>A processing instruction</DD>

</DL>
<HR>


<DL>
<DT><B>Event Type</B></DT>
<DD><TT>'entity'</TT></DD>
<DT><B>Event Data</B></DT>
<DD><TT>SGMLS_Entity</TT></DD>
<DT><B>Description</B></DT>
<DD>A non-SGML external entity.</DD>

</DL>
<HR>


<DL>
<DT><B>Event Type</B></DT>
<DD><TT>'start_subdoc'</TT></DD>
<DT><B>Event Data</B></DT>
<DD><TT>SGMLS_Entity</TT></DD>
<DT><B>Description</B></DT>
<DD>The beginning of an SGML subdocument.</DD>

</DL>
<HR>


<DL>
<DT><B>Event Type</B></DT>
<DD><TT>'end_subdoc'</TT></DD>
<DT><B>Event Data</B></DT>
<DD><TT>SGMLS_Entity</TT></DD>
<DT><B>Description</B></DT>
<DD>The end of an SGML subdocument.</DD>

</DL>
<HR>


<DL>
<DT><B>Event Type</B></DT>
<DD><TT>'conforming'</TT></DD>
<DT><B>Event Data</B></DT>
<DD>[none]</DD>
<DT><B>Description</B></DT>
<DD>The document was valid.</DD>

</DL>
<HR>


<P>For example, if <TT>$event->type</TT> returns
<TT>'start_element'</TT>, then
<TT>$event->data</TT> will return an object belonging to the
<A HREF=sgmlselement.html><TT>SGMLS_Element</TT></A>
class (which will contain a list of attributes, etc. -- see
below), <TT>$event->file</TT> and
<TT>$event->line</TT> will return the file and line-number
in which the element appeared (if you called <TT>sgmls</TT> or <A HREF="http://www.jclark.com/sp.html"><TT>nsgmls</TT></A> with
the <IT>-l</IT> flag), and
<TT>$event->element</TT> will return the element currently
in force (in this case, the same as
<TT>$event->data</TT>).</P>


<P><B>Links</B>: <A HREF=sgmlselement.html>Next</A> <A HREF=sgmlsevent.html>Previous</A> <A HREF=sgmlspm.html>Up</A> <A HREF=sgmlspm.html>Top</A></P>


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