class Nokogiri::XML::Node
def []=(name, value)
# "\n"
# "
# => "
doc.to_html
child.attribute("size").namespace = ns
ns = doc.root.namespace_definitions.find { |ns| ns.prefix == "width" }
child["size"] = "broad"
child = doc.at_css("child")
EOF
doc = Nokogiri::XML(<<~EOF)
*Example:* Add a namespaced attribute.
# => "
child.to_html
child["size"] = "broad"
child = doc.at_css("child")
doc = Nokogiri::XML("
*Example*
[Returns] +value+
see the example below.
namespaced attributes for update, use #attribute_with_ns. To add a namespaced attribute,
⚠ Note that attributes with namespaces cannot be accessed with this method. To access
Update the attribute +name+ to +value+, or create the attribute if it does not exist.
:call-seq: []=(name, value) → value
def []=(name, value) set(name.to_s, value.to_s) end