Object
Returns the default namespace for this node or nil.
Usage:
doc = XML::Document.string('<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"/>') ns = doc.root.namespaces.default_namespace assert_equal(ns.href, 'http://schemas.xmlsoap.org/soap/envelope/')
# File lib/libxml/namespaces.rb, line 15 15: def default 16: find_by_prefix(nil) 17: end
Assigns a name (prefix) to the default namespace. This makes it much easier to perform XML::XPath searches.
Usage:
doc = XML::Document.string('<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"/>') doc.root.namespaces.default_prefix = 'soap' node = doc.root.find_first('soap:Envelope')
# File lib/libxml/namespaces.rb, line 30 30: def default_prefix=(prefix) 31: # Find default prefix 32: ns = find_by_prefix(nil) 33: raise(ArgumentError, "No default namespace was found") unless ns 34: Namespace.new(self.node, prefix, ns.href) 35: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.