<HTML> <HEAD> <TITLE>What do I do with an SGMLS_Element?</TITLE> </HEAD> <BODY> <P><B>Links</B>: <A HREF=sgmlsattribute.html>Next</A> <A HREF=events.html>Previous</A> <A HREF=sgmlspm.html>Up</A> <A HREF=sgmlspm.html>Top</A></P> <H1>What do I do with an <TT>SGMLS_Element</TT>?</H1> <P>Altogether, there are six classes in <A HREF=sgmlspm.html><TT>SGMLS.pm</TT></A>, each with its own methods: in addition to <A HREF=sgmls.html><TT>SGMLS</TT></A> (for the parse) and <A HREF=sgmlsevent.html><TT>SGMLS_Event</TT></A> (for a specific event), the classes are <TT>SGMLS_Element</TT>, <A HREF=sgmlsattribute.html><TT>SGMLS_Attribute</TT></A>, <A HREF=sgmlsentity.html><TT>SGMLS_Entity</TT></A>, and <A HREF=sgmlsnotation.html><TT>SGMLS_Notation</TT></A>. Like all of these, <TT>SGMLS_Element</TT> has a number of methods available for obtaining different types of information. For example, if you were to use</P> <P> <PRE>my $element = $event->data</PRE> </P> <P>to retrieve the data for a <TT>'start_element'</TT> or <TT>'end_element'</TT> event, then you could use the methods listed in table 3 to find more information about the element.</P> <H3>Table 3: The <TT>SGMLS_Element</TT> class</H3> <HR> <DL> <DT><B>Method</B></DT> <DD><TT>name</TT></DD> <DT><B>Return Type</B></DT> <DD>string</DD> <DT><B>Description</B></DT> <DD>The name (or GI), in upper-case.</DD> </DL> <HR> <DL> <DT><B>Method</B></DT> <DD><TT>parent</TT></DD> <DT><B>Return Type</B></DT> <DD><TT>SGMLS_Element</TT></DD> <DT><B>Description</B></DT> <DD>The parent element, or <TT>''</TT> if this is the top element.</DD> </DL> <HR> <DL> <DT><B>Method</B></DT> <DD><TT>attributes</TT></DD> <DT><B>Return Type</B></DT> <DD>HASH</DD> <DT><B>Description</B></DT> <DD>Return a reference to a hash table of <TT>SGMLS_Attribute</TT> objects, keyed by the attribute names (in upper-case).</DD> </DL> <HR> <DL> <DT><B>Method</B></DT> <DD><TT>attribute_names</TT></DD> <DT><B>Return Type</B></DT> <DD>ARRAY</DD> <DT><B>Description</B></DT> <DD>A list of all attribute names for the current element (in upper-case).</DD> </DL> <HR> <DL> <DT><B>Method</B></DT> <DD><TT>attribute(<IT>aname</IT>)</TT></DD> <DT><B>Return Type</B></DT> <DD><TT>SGMLS_Attribute</TT></DD> <DT><B>Description</B></DT> <DD>Return the attribute named ANAME.</DD> </DL> <HR> <DL> <DT><B>Method</B></DT> <DD><TT>set_attribute(<IT>attribute</IT>)</TT></DD> <DT><B>Return Type</B></DT> <DD>[none]</DD> <DT><B>Description</B></DT> <DD>The <IT>attribute</IT> argument should be an object belonging to the <A HREF="sgmlsattribute.html"><TT>SGMLS_Attribute</TT></A> class. Add it to the element, replacing any previous attribute with the same name.</DD> </DL> <HR> <DL> <DT><B>Method</B></DT> <DD><TT>in(<IT>name</IT>)</TT></DD> <DT><B>Return Type</B></DT> <DD><TT>SGMLS_Element</TT></DD> <DT><B>Description</B></DT> <DD>If the current element's parent is named <IT>name</IT>, return the parent; otherwise, return <TT>''</TT>.</DD> </DL> <HR> <DL> <DT><B>Method</B></DT> <DD><TT>within(<IT>name</IT>)</TT></DD> <DT><B>Return Type</B></DT> <DD><TT>SGMLS_Element</TT></DD> <DT><B>Description</B></DT> <DD>If any ancestor of the current element is named <IT>name</IT>, return it; otherwise, return <TT>''</TT>.</DD> </DL> <HR> <P><B>Links</B>: <A HREF=sgmlsattribute.html>Next</A> <A HREF=events.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"><dmeggins@aix1.uottawa.ca></A></ADDRESS> </BODY> </HTML>