JezK
Edit File: %5b%5d-i.ri
U:RDoc::AnyMethod[iI"[]:ETI"REXML::Elements#[];TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"LFetches a child element. Filters only Element children, regardless of ;TI"the XPath match.;To:RDoc::Markup::List: @type: NOTE:@items[o:RDoc::Markup::ListItem:@label[I" index;T; [o; ; [I"=the search parameter. This is either an Integer, which ;TI"Cwill be used to find the index'th child Element, or an XPath, ;TI"@which will be used to search for the Element. <em>Because ;TI"Gof the nature of XPath searches, any element in the connected XML ;TI"Edocument can be fetched through any other element.</em> <b>The ;TI"KInteger index is 1-based, not 0-based.</b> This means that the first ;TI"Kchild element is at index 1, not 0, and the +n+th element is at index ;TI"L+n+, not <tt>n-1</tt>. This is because XPath indexes element children ;TI"@starting from 1, not 0, and the indexes should be the same.;To;;[I" name;T; [o; ; [I"9optional, and only used in the first argument is an ;TI"EInteger. In that case, the index'th child Element that has the ;TI"Msupplied name will be returned. Note again that the indexes start at 1.;To;;[I"Returns;T; [o; ; [I";the first matching Element, or nil if no child matched;To:RDoc::Markup::Verbatim; [ I"@doc = Document.new '<a><b/><c id="1"/><c id="2"/><d/></a>' ;TI")doc.root.elements[1] #-> <b/> ;TI"0doc.root.elements['c'] #-> <c id="1"/> ;TI"/doc.root.elements[2,'c'] #-> <c id="2"/>;T:@format0: @fileI"lib/rexml/element.rb;T:0@omit_headings_from_table_of_contents_below000[ I"( index, name=nil);T@6FI" Elements;TcRDoc::NormalClass00