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 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459
|
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<STYLE TYPE="text/css">@import "style.css";</STYLE>
</HEAD>
<BODY>
<H1>class Element</H1>
<B>Extends </B>Parent<BR>
<B>Includes </B>Namespace<HR>
Represents a tagged XML element. Elements are characterized by having children, attributes, and names, and can themselves be children.
<H2>Attributes</H2>
<UL>
<LI>
<A HREF="#NA">attributes</A>
</LI>
<LI>
<A HREF="#N14">context</A>
</LI>
<LI>
<A HREF="#NF">elements</A>
</LI>
</UL>
<H2>Methods</H2>
<UL>
<LI>
<A HREF="#N9C">add_attribute</A>
</LI>
<LI>
<A HREF="#NA3">add_attributes</A>
</LI>
<LI>
<A HREF="#N42">add_element</A>
</LI>
<LI>
<A HREF="#N3A">add_namespace</A>
</LI>
<LI>
<A HREF="#N8E">add_text</A>
</LI>
<LI>
<A HREF="#N1C">clone</A>
</LI>
<LI>
<A HREF="#NA7">delete_attribute</A>
</LI>
<LI>
<A HREF="#N49">delete_element</A>
</LI>
<LI>
<A HREF="#N3E">delete_namespace</A>
</LI>
<LI>
<A HREF="#N5F">each_element</A>
</LI>
<LI>
<A HREF="#N57">each_element_with_attribute</A>
</LI>
<LI>
<A HREF="#N5B">each_element_with_text</A>
</LI>
<LI>
<A HREF="#NB5">each_with_something</A>
</LI>
<LI>
<A HREF="#NB2">Element</A>
</LI>
<LI>
<A HREF="#NB9">Element</A>
</LI>
<LI>
<A HREF="#N63">get_elements</A>
</LI>
<LI>
<A HREF="#N80">get_text</A>
</LI>
<LI>
<A HREF="#N95">has_attributes</A>
</LI>
<LI>
<A HREF="#N50">has_elements</A>
</LI>
<LI>
<A HREF="#N72">has_text</A>
</LI>
<LI>
<A HREF="#N18">initialize</A>
</LI>
<LI>
<A HREF="#N33">namespace</A>
</LI>
<LI>
<A HREF="#N6A">next_element</A>
</LI>
<LI>
<A HREF="#NC0">parse</A>
</LI>
<LI>
<A HREF="#NC3">parse_children</A>
</LI>
<LI>
<A HREF="#N2C">prefixes</A>
</LI>
<LI>
<A HREF="#N6E">previous_element</A>
</LI>
<LI>
<A HREF="#N29">raw</A>
</LI>
<LI>
<A HREF="#N1F">root</A>
</LI>
<LI>
<A HREF="#N79">text</A>
</LI>
<LI>
<A HREF="#N87">text=</A>
</LI>
<LI>
<A HREF="#N26">whitespace</A>
</LI>
<LI>
<A HREF="#NAE">write</A>
</LI>
<LI>
<A HREF="#NC7">write_children</A>
</LI>
</UL>
<HR>
<H2>Attributes</H2>
<DIV CLASS="attributes">
<DIV STYLE="padding-bottom: 0.5em; padding-top: 0.5em;">
<B>attributes</B> (reader)
Mechanisms for accessing attributes and child elements of this element.
</DIV>
<DIV STYLE="padding-bottom: 0.5em; padding-top: 0.5em;">
<B>context</B> (accessor)
</DIV>
<DIV STYLE="padding-bottom: 0.5em; padding-top: 0.5em;">
<B>elements</B> (reader)
Mechanisms for accessing attributes and child elements of this element.
</DIV>
</DIV>
<H2>Methods</H2>
<DIV CLASS="method">
<A NAME="N9C">
<H3>add_attribute</H3>
</A><B style="padding-right: 1em;">Returns</B>
the Attribute added
<HR>
Adds an attribute to this element, overwriting any existing attribute by the same name.
</DIV>
<DIV CLASS="method">
<A NAME="NA3">
<H3>add_attributes</H3>
</A>
<HR>
Add multiple attributes to this element. EG: el.add_attributes( {"name1"=>"value1", "name2"=>"value2"} ) el.add_attributes( [ ["name1","value1"], ["name2"=>"value2"] ] )
</DIV>
<DIV CLASS="method">
<A NAME="N42">
<H3>add_element</H3>
</A><B style="padding-right: 1em;">Returns</B>
the Element that was added
<HR>
Adds a child to this element, optionally setting attributes in the element.
</DIV>
<DIV CLASS="method">
<A NAME="N3A">
<H3>add_namespace</H3>
</A>
<HR>
Adds a namespace to this element
</DIV>
<DIV CLASS="method">
<A NAME="N8E">
<H3>add_text</H3>
</A><B style="padding-right: 1em;">Returns</B>
self. NOTE that contrary to most REXML methods, the object added to the parent is not returned.
<HR>
A helper method to add a Text child. Actual Text instances can be added with regular Parent methods, such as add() and <<()
</DIV>
<DIV CLASS="method">
<A NAME="N1C">
<H3>clone</H3>
</A>
<HR>
</DIV>
<DIV CLASS="method">
<A NAME="NA7">
<H3>delete_attribute</H3>
</A><B style="padding-right: 1em;">Returns</B>
the attribute removed, or nil if this Element did not contain a matching attribute
<HR>
Removes an attribute
</DIV>
<DIV CLASS="method">
<A NAME="N49">
<H3>delete_element</H3>
</A><B style="padding-right: 1em;">Returns</B>
the element that was removed.
<HR>
Deletes a child element.
</DIV>
<DIV CLASS="method">
<A NAME="N3E">
<H3>delete_namespace</H3>
</A>
<HR>
NEEDS DOCUMENTATION
</DIV>
<DIV CLASS="method">
<A NAME="N5F">
<H3>each_element</H3>
</A>
<HR>
Synonym for elements.each
</DIV>
<DIV CLASS="method">
<A NAME="N57">
<H3>each_element_with_attribute</H3>
</A>
<HR>
Iterates through the children, yielding for each Element that has a particular attribute set.
</DIV>
<DIV CLASS="method">
<A NAME="N5B">
<H3>each_element_with_text</H3>
</A>
<HR>
Iterates through the children, yielding for each Element that has a particular text set. @see text
</DIV>
<DIV CLASS="method">
<A NAME="NB5">
<H3>each_with_something</H3>
</A>
<HR>
A private helper method
</DIV>
<DIV CLASS="method">
<A NAME="NB2">
<H3>Element</H3>
</A>
<HR>
</DIV>
<DIV CLASS="method">
<A NAME="NB9">
<H3>Element</H3>
</A><B style="padding-right: 1em;">Returns</B>
an array with [tag_name_S, closed_B, attributes_A]
<HR>
A helper method, to consolidate the common code between parse and parse_stream. @return an array with [tag_name_S, closed_B, attributes_A]
</DIV>
<DIV CLASS="method">
<A NAME="N63">
<H3>get_elements</H3>
</A><B style="padding-right: 1em;">Returns</B>
an array of Elements that match the supplied path
<HR>
This is a little slower than calling elements.each directly.
</DIV>
<DIV CLASS="method">
<A NAME="N80">
<H3>get_text</H3>
</A><B style="padding-right: 1em;">Returns</B>
the first Text child encountered.
<HR>
This is the same method as text(), only this method returns the actual Text object, rather than the String content.
</DIV>
<DIV CLASS="method">
<A NAME="N95">
<H3>has_attributes</H3>
</A><B style="padding-right: 1em;">Returns</B>
true if this element has any attributes set, false otherwise.
<HR>
</DIV>
<DIV CLASS="method">
<A NAME="N50">
<H3>has_elements</H3>
</A><B style="padding-right: 1em;">Returns</B>
true if this element has at least one child Element
<HR>
</DIV>
<DIV CLASS="method">
<A NAME="N72">
<H3>has_text</H3>
</A><B style="padding-right: 1em;">Returns</B>
true if this element has at least one Text child
<HR>
</DIV>
<DIV CLASS="method">
<A NAME="N18">
<H3>initialize</H3>
</A>
<HR>
Constructor
</DIV>
<DIV CLASS="method">
<A NAME="N33">
<H3>namespace</H3>
</A><B style="padding-right: 1em;">Returns</B>
the URI for a namespace, or the empty string if no such namespace is declared
<HR>
</DIV>
<DIV CLASS="method">
<A NAME="N6A">
<H3>next_element</H3>
</A>
<HR>
Returns the next sibling that is an element, or nil if there is no Element sibling after this one
</DIV>
<DIV CLASS="method">
<A NAME="NC0">
<H3>parse</H3>
</A>
<HR>
</DIV>
<DIV CLASS="method">
<A NAME="NC3">
<H3>parse_children</H3>
</A>
<HR>
A private helper method
</DIV>
<DIV CLASS="method">
<A NAME="N2C">
<H3>prefixes</H3>
</A><B style="padding-right: 1em;">Returns</B>
an Array of all defined namespaces
<HR>
</DIV>
<DIV CLASS="method">
<A NAME="N6E">
<H3>previous_element</H3>
</A>
<HR>
Returns the previous sibling that is an element, or nil if there is no Element sibling prior to this one
</DIV>
<DIV CLASS="method">
<A NAME="N29">
<H3>raw</H3>
</A>
<HR>
</DIV>
<DIV CLASS="method">
<A NAME="N1F">
<H3>root</H3>
</A><B style="padding-right: 1em;">Returns</B>
the root of the document that this element belongs to. If this element doesn't belong to a document, but does belong to another Element, the parent's root will be returned, until the earliest ancestor is found.
<HR>
</DIV>
<DIV CLASS="method">
<A NAME="N79">
<H3>text</H3>
</A><B style="padding-right: 1em;">Returns</B>
the String content of the first child text element encountered.
<HR>
A convenience method which returns the first child text element. NOTE that an element may have multiple Text elements, perhaps separated by other children; consider: "<p>some text <b>this is bold!</b> more text<p>" The element <p> has two text elements, "some text " and " more text". This method would return only the first, "some text ".
</DIV>
<DIV CLASS="method">
<A NAME="N87">
<H3>text=</H3>
</A><B style="padding-right: 1em;">Returns</B>
self. NOTE that contrary to most REXML methods, the replaced content is not returned.
<HR>
Sets the first Text child of this object. See text() for a discussion about Text children. If a Text child already exists, the child is replaced by this content. This means that Text content can be deleted by calling this method with a nil argument. In this case, the next Text child becomes the first Text child. In no case is the order of any siblings disturbed.
</DIV>
<DIV CLASS="method">
<A NAME="N26">
<H3>whitespace</H3>
</A>
<HR>
</DIV>
<DIV CLASS="method">
<A NAME="NAE">
<H3>write</H3>
</A>
<HR>
Writes out this element, and recursively, all children.
</DIV>
<DIV CLASS="method">
<A NAME="NC7">
<H3>write_children</H3>
</A>
<HR>
A private helper method
</DIV>
<DIV CLASS="footer">
API documentation generated by <A HREF="http://www.germane-software.com/~ser/Software/api2xml">API2XML</A>
</DIV>
</BODY>
</HTML>
|