Module: Nokogiri::Hpricot

Defined in:
lib/nokogiri/hpricot.rb

Constant Summary collapse

STag =
String
Elem =
XML::Node
NamedCharacters =
Nokogiri::HTML::NamedCharacters

Class Method Summary collapse

Class Method Details

.add_decorators(doc) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/nokogiri/hpricot.rb', line 25

def add_decorators(doc)
  doc.decorators['node'] << Decorators::Hpricot::Node
  doc.decorators['document'] << Decorators::Hpricot::Node
  doc.decorators['nodeset'] << Decorators::Hpricot::NodeSet
  doc.decorate!
  doc
end

.make(string) ⇒ Object



19
20
21
22
23
# File 'lib/nokogiri/hpricot.rb', line 19

def make string
  ns = XML::NodeSet.new
  ns << XML::Text.new(string)
  ns
end

.parse(*args) ⇒ Object



9
10
11
12
# File 'lib/nokogiri/hpricot.rb', line 9

def parse(*args)
  doc = Nokogiri.parse(*args)
  add_decorators(doc)
end

.XML(string) ⇒ Object



14
15
16
17
# File 'lib/nokogiri/hpricot.rb', line 14

def XML(string)
  doc = Nokogiri::XML.parse(string)
  add_decorators(doc)
end