Synonym for Element.elements
.each
Evaluates to true
if this element has any attributes set, false otherwise.
Adds an attribute to this element, overwriting any existing attribute by the same name.
can be either an Attribute
or a String. If an Attribute
, the attribute is added to the list of Element
attributes. If String, the argument is used as the name of the new attribute, and the value parameter must be supplied.
Required if key
is a String, and ignored if the first argument is an Attribute
. This is a String, and is used as the value of the new Attribute
. This should be the unnormalized value of the attribute (without entities).
the Attribute
added
e = Element.new 'e' e.add_attribute( 'a', 'b' ) #-> <e a='b'/> e.add_attribute( 'x:a', 'c' ) #-> <e a='b' x:a='c'/> e.add_attribute Attribute.new('b', 'd') #-> <e a='b' x:a='c' b='d'/>
Add multiple attributes to this element.
is either a hash, or array of arrays
el.add_attributes( {"name1"=>"value1", "name2"=>"value2"} ) el.add_attributes( [ ["name1","value1"], ["name2"=>"value2"] ] )
Removes an attribute
either an Attribute
or a String. In either case, the attribute is found by matching the attribute name to the argument, and then removed. If no attribute is found, no action is taken.
the attribute removed, or nil if this Element
did not contain a matching attribute
e = Element.new('E') e.add_attribute( 'name', 'Sean' ) #-> <E name='Sean'/> r = e.add_attribute( 'sur:name', 'Russell' ) #-> <E name='Sean' sur:name='Russell'/> e.delete_attribute( 'name' ) #-> <E sur:name='Russell'/> e.delete_attribute( r ) #-> <E/>
Fetches an attribute
the name by which to search for the attribute. Can be a prefix:name
namespace name.
The first matching attribute, or nil if there was none. This
value is an Attribute
node, not the String value of the attribute.
doc = Document.new '<a x:foo="1" foo="2" bar="3"/>' doc.root.attributes.get_attribute("foo").value #-> "2" doc.root.attributes.get_attribute("x:foo").value #-> "1"
Replaces one child with another, making sure the nodelist is correct @param to_replace the child to replace (must be a Child
) @param replacement the child to insert into the nodelist (must be a Child
)
Generates a Source
object @param arg Either a String, or an IO
@return a Source
, or nil if a bad argument was given
Creates a socket at address
If address
is multicast address then interface_address
and multicast_interface
can be set as optional.
A created socket is bound to interface_address
. If you use IPv4 multicast then the interface of interface_address
is used as the inbound interface. If interface_address
is omitted or nil then ‘0.0.0.0’ or ‘::1’ is used.
If you use IPv6 multicast then multicast_interface
is used as the inbound interface. multicast_interface
is a network interface index. If multicast_interface
is omitted then 0 (default interface) is used.
Returns an expiry Time
based on sec
which can be one of:
Creates a Rinda::Tuple
for ary
.
Try to get the XML
associated with rss
. Return rss
if it already looks like XML
, or treat it as a URI
, or a file to get the XML
,
maybe_xml? tests if source is a string that looks like XML
.