Displaying 2 results from an estimated 2 matches for "basexmlparser".
2006 Jun 24
1
Parsing XML with REXML problem
...is my code:
require ''rexml/document''
include REXML
# classes to represent the objects and relationships in the xml file
class Article
attr_accessor :id, :post, :archive, :ntype, :head, :blurb, :body,
:fblurb, :fimage, :att, :source, :copy, :brand
end
# the base parser
class BaseXMLParser
def initialize(filename)
@raw_xml = File.open(filename).read
@newsfeed = []
end
end
# DOM-based parsing
class FeedXMLParser < BaseXMLParser
def get_newsfeed
doc = Document.new(@raw_xml)
XPath.each(doc, ''newsfeed/article'') do |article|
art = Article...
2006 Jun 26
0
DBI question. How do I load a database with data parsed from REXML?
...require ''rexml/document''
include REXML
# classes to represent the objects and relationships in the xml file
class Article
attr_accessor :id, :post, :archive, :ntype, :head, :blurb, :body,
:fblurb, :fimage, :att, :source, :copy, :brand
end
# the base parser
class BaseXMLParser
def initialize(filename)
@raw_xml = File.open(filename).read
@newsfeed = []
end
end
# DOM-based parsing
class FeedXMLParser < BaseXMLParser
def get_newsfeed
doc = Document.new(@raw_xml)
XPath.each(doc, ''NEWSFEED/ARTICLE'') do |article|...