Make a copy of this object
Examples
c = CData.new( "Some text" ) d = c.clone d.to_s # -> "Some text"
Retrieves a named notation. Only notations declared in the internal DTD
subset can be retrieved.
Method
contributed by Henrik Martensson
Should be obvious
@return the XMLDecl
encoding of this document as an Encoding
object. If no XMLDecl
has been set, returns the default encoding.
Creates a shallow copy of self.
d = Document.new "<a><b/><b/><c><d/></c></a>" new_a = d.root.clone puts new_a # => "<a/>"
Get an array of all Comment
children. IMMUTABLE
Inherited from Encoding
Overridden to support optimized en/decoding
Finds and returns the first node that matches the supplied xpath.
The context element
The xpath to search for. If not supplied or nil, returns the first node matching ‘*’.
If supplied, a Hash
which defines a namespace mapping.
If supplied, a Hash
which maps $variables in the query to values. This can be used to avoid XPath
injection attacks or to automatically handle escaping string values.
XPath.first( node ) XPath.first( doc, "//b"} ) XPath.first( node, "a/x:b", { "x"=>"http://doofus" } ) XPath.first( node, '/book/publisher/text()=$publisher', {}, {"publisher"=>"O'Reilly"})