TIVI-153: add as dependency for iputils
[profile/ivi/perl-SGMLSpm.git] / DOC / HTML / SGMLSpm / sgmlselement.html
1 <HTML>
2 <HEAD>
3 <TITLE>What do I do with an SGMLS_Element?</TITLE>
4 </HEAD>
5 <BODY>
6
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>
8
9 <H1>What do I do with an <TT>SGMLS_Element</TT>?</H1>
10
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>
21
22 <P>
23 <PRE>my $element = $event->data</PRE>
24 </P>
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>
29
30
31 <H3>Table 3: The <TT>SGMLS_Element</TT> class</H3>
32
33 <HR>
34 <DL>
35 <DT><B>Method</B></DT>
36 <DD><TT>name</TT></DD>
37 <DT><B>Return Type</B></DT>
38 <DD>string</DD>
39 <DT><B>Description</B></DT>
40 <DD>The name (or GI), in upper-case.</DD>
41
42 </DL>
43 <HR>
44
45
46 <DL>
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
53 element.</DD>
54
55 </DL>
56 <HR>
57
58
59 <DL>
60 <DT><B>Method</B></DT>
61 <DD><TT>attributes</TT></DD>
62 <DT><B>Return Type</B></DT>
63 <DD>HASH</DD>
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>
68
69 </DL>
70 <HR>
71
72
73 <DL>
74 <DT><B>Method</B></DT>
75 <DD><TT>attribute_names</TT></DD>
76 <DT><B>Return Type</B></DT>
77 <DD>ARRAY</DD>
78 <DT><B>Description</B></DT>
79 <DD>A list of all attribute names for the current element (in
80 upper-case).</DD>
81
82 </DL>
83 <HR>
84
85
86 <DL>
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>
93
94 </DL>
95 <HR>
96
97
98 <DL>
99 <DT><B>Method</B></DT>
100 <DD><TT>set_attribute(<IT>attribute</IT>)</TT></DD>
101 <DT><B>Return Type</B></DT>
102 <DD>[none]</DD>
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
107 the same name.</DD>
108
109 </DL>
110 <HR>
111
112
113 <DL>
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
121 <TT>''</TT>.</DD>
122
123 </DL>
124 <HR>
125
126
127 <DL>
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
135 <TT>''</TT>.</DD>
136
137 </DL>
138 <HR>
139
140
141
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>
143
144
145 <ADDRESS>David Megginson <A HREF="mailto:dmeggins@aix1.uottawa.ca">&lt;dmeggins@aix1.uottawa.ca&gt;</A></ADDRESS>
146 </BODY>
147 </HTML>