3 <TITLE>What do I do with an SGMLS_Element?</TITLE>
7 <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>
9 <H1>What do I do with an <TT>SGMLS_Element</TT>?</H1>
11 <P>Altogether, there are six classes in <A HREF=sgmlspm.html><TT>SGMLS.pm</TT></A>, each with its
12 own methods: in addition to <A HREF=sgmls.html><TT>SGMLS</TT></A> (for the parse) and
13 <A HREF=sgmlsevent.html><TT>SGMLS_Event</TT></A>
14 (for a specific event), the classes are
15 <TT>SGMLS_Element</TT>, <A HREF=sgmlsattribute.html><TT>SGMLS_Attribute</TT></A>,
16 <A HREF=sgmlsentity.html><TT>SGMLS_Entity</TT></A>,
17 and <A HREF=sgmlsnotation.html><TT>SGMLS_Notation</TT></A>.
18 Like all of these, <TT>SGMLS_Element</TT> has a number
19 of methods available for obtaining different types of information.
20 For example, if you were to use</P>
23 <PRE>my $element = $event->data</PRE>
25 <P>to retrieve the data for a <TT>'start_element'</TT> or
26 <TT>'end_element'</TT> event, then you could use the methods
27 listed in table 3 to find more
28 information about the element.</P>
31 <H3>Table 3: The <TT>SGMLS_Element</TT> class</H3>
35 <DT><B>Method</B></DT>
36 <DD><TT>name</TT></DD>
37 <DT><B>Return Type</B></DT>
39 <DT><B>Description</B></DT>
40 <DD>The name (or GI), in upper-case.</DD>
47 <DT><B>Method</B></DT>
48 <DD><TT>parent</TT></DD>
49 <DT><B>Return Type</B></DT>
50 <DD><TT>SGMLS_Element</TT></DD>
51 <DT><B>Description</B></DT>
52 <DD>The parent element, or <TT>''</TT> if this is the top
60 <DT><B>Method</B></DT>
61 <DD><TT>attributes</TT></DD>
62 <DT><B>Return Type</B></DT>
64 <DT><B>Description</B></DT>
65 <DD>Return a reference to a hash table of
66 <TT>SGMLS_Attribute</TT> objects, keyed by the attribute
67 names (in upper-case).</DD>
74 <DT><B>Method</B></DT>
75 <DD><TT>attribute_names</TT></DD>
76 <DT><B>Return Type</B></DT>
78 <DT><B>Description</B></DT>
79 <DD>A list of all attribute names for the current element (in
87 <DT><B>Method</B></DT>
88 <DD><TT>attribute(<IT>aname</IT>)</TT></DD>
89 <DT><B>Return Type</B></DT>
90 <DD><TT>SGMLS_Attribute</TT></DD>
91 <DT><B>Description</B></DT>
92 <DD>Return the attribute named ANAME.</DD>
99 <DT><B>Method</B></DT>
100 <DD><TT>set_attribute(<IT>attribute</IT>)</TT></DD>
101 <DT><B>Return Type</B></DT>
103 <DT><B>Description</B></DT>
104 <DD>The <IT>attribute</IT> argument should be an
105 object belonging to the <A HREF="sgmlsattribute.html"><TT>SGMLS_Attribute</TT></A>
106 class. Add it to the element, replacing any previous attribute with
114 <DT><B>Method</B></DT>
115 <DD><TT>in(<IT>name</IT>)</TT></DD>
116 <DT><B>Return Type</B></DT>
117 <DD><TT>SGMLS_Element</TT></DD>
118 <DT><B>Description</B></DT>
119 <DD>If the current element's parent is named
120 <IT>name</IT>, return the parent; otherwise, return
128 <DT><B>Method</B></DT>
129 <DD><TT>within(<IT>name</IT>)</TT></DD>
130 <DT><B>Return Type</B></DT>
131 <DD><TT>SGMLS_Element</TT></DD>
132 <DT><B>Description</B></DT>
133 <DD>If any ancestor of the current element is named
134 <IT>name</IT>, return it; otherwise, return
142 <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>
145 <ADDRESS>David Megginson <A HREF="mailto:dmeggins@aix1.uottawa.ca"><dmeggins@aix1.uottawa.ca></A></ADDRESS>