Cross Reference: parser.rb
xref
: /
ontohub
/
lib
/
hets
/
dg
/
parser.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
022df7f893582e7e8efffce816ae27f6d1015766
Eugen Kuksa
module
Hets
022df7f893582e7e8efffce816ae27f6d1015766
Eugen Kuksa
module
DG
022df7f893582e7e8efffce816ae27f6d1015766
Eugen Kuksa
class
Parser
022df7f893582e7e8efffce816ae27f6d1015766
Eugen Kuksa
attr_accessor
:
resource
, :
callback
022df7f893582e7e8efffce816ae27f6d1015766
Eugen Kuksa
022df7f893582e7e8efffce816ae27f6d1015766
Eugen Kuksa
def
initialize
(
resource
)
022df7f893582e7e8efffce816ae27f6d1015766
Eugen Kuksa
self.resource
=
resource
022df7f893582e7e8efffce816ae27f6d1015766
Eugen Kuksa
end
022df7f893582e7e8efffce816ae27f6d1015766
Eugen Kuksa
022df7f893582e7e8efffce816ae27f6d1015766
Eugen Kuksa
def
parse
(
callback
:
nil
)
022df7f893582e7e8efffce816ae27f6d1015766
Eugen Kuksa
input
=
resource.respond
_to
?
(:
close
)
?
resource
:
File.open
(
resource
)
022df7f893582e7e8efffce816ae27f6d1015766
Eugen Kuksa
parser
(
callback
)
.
parse
(
input
)
022df7f893582e7e8efffce816ae27f6d1015766
Eugen Kuksa
input.close
022df7f893582e7e8efffce816ae27f6d1015766
Eugen Kuksa
end
022df7f893582e7e8efffce816ae27f6d1015766
Eugen Kuksa
022df7f893582e7e8efffce816ae27f6d1015766
Eugen Kuksa
private
022df7f893582e7e8efffce816ae27f6d1015766
Eugen Kuksa
def
parser
(
callback
)
022df7f893582e7e8efffce816ae27f6d1015766
Eugen Kuksa
listener
=
NokogiriListener.new
(
callback
)
022df7f893582e7e8efffce816ae27f6d1015766
Eugen Kuksa
Nokogiri
::
XML
::
SAX
::
Parser.new
(
listener
)
022df7f893582e7e8efffce816ae27f6d1015766
Eugen Kuksa
end
022df7f893582e7e8efffce816ae27f6d1015766
Eugen Kuksa
end
022df7f893582e7e8efffce816ae27f6d1015766
Eugen Kuksa
end
022df7f893582e7e8efffce816ae27f6d1015766
Eugen Kuksa
end