Class: HTMLTree::Document
Overview
This is a Element that represents the whole document (and makes a scope for the DTD declaration)
Instance Method Summary
collapse
#add_child, #can_have_children?, #children, #content, #dump, #get_elements, #has_children?, #parent, #parent=, #remove_child, #rexml_match, #root
Constructor Details
Returns a new instance of Document.
115
116
117
|
# File 'lib/web/htmltools/element.rb', line 115
def initialize
initialize_tree_element(nil, [])
end
|
Instance Method Details
#as_rexml_document(context = {}) ⇒ Object
62
63
64
65
66
67
68
|
# File 'lib/web/htmltools/xpath.rb', line 62
def as_rexml_document(context = {})
node = REXML::Document.new(nil, context)
node.add( html_node.as_rexml_document(node, context) )
node
end
|
#each(&block) ⇒ Object
123
124
125
|
# File 'lib/web/htmltools/element.rb', line 123
def each(&block)
children.each { |ch| ch.each(&block) }
end
|
#html_node ⇒ Object
Return my child <html> node, if any.
136
137
138
|
# File 'lib/web/htmltools/element.rb', line 136
def html_node
children.detect { |ea| ea.tag == 'html' }
end
|
131
132
133
|
# File 'lib/web/htmltools/element.rb', line 131
def tag
''
end
|
119
120
121
|
# File 'lib/web/htmltools/element.rb', line 119
def to_s
''
end
|
#write(io) ⇒ Object
127
128
129
|
# File 'lib/web/htmltools/element.rb', line 127
def write(io)
children.each { |t| t.write(io) }
end
|