Class: CBETA::XMLDocument

Inherits:
Object
  • Object
show all
Defined in:
lib/cbeta/xml_document.rb

Constant Summary collapse

PASS =
%w(back graphic mulu rdg sic teiHeader)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string_or_io) ⇒ XMLDocument

Returns a new instance of XMLDocument.



8
9
10
11
12
# File 'lib/cbeta/xml_document.rb', line 8

def initialize(string_or_io)
  @doc = Nokogiri::XML(string_or_io)
  @doc.remove_namespaces!
  @gaiji = CBETA::Gaiji.new
end

Instance Attribute Details

#docObject (readonly)

Returns the value of attribute doc.



6
7
8
# File 'lib/cbeta/xml_document.rb', line 6

def doc
  @doc
end

Instance Method Details

#to_textObject



14
15
16
17
18
19
# File 'lib/cbeta/xml_document.rb', line 14

def to_text
  @format = 'text'
  @gaiji_norm = [true]
  @next_line_buf = ''
  traverse(@doc.root)
end