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