I seem to have some personal confusion with how to correctly utilize the
rexml/dtd library. I am using ruby version 1.8.6 and when I orginally tried
to use the code I received some unknown method errors. I modified the code
in the case statement contained in dtd.rb from the notation
when ElementDecl.PATTERN_RE
to when ElementDecl::PATTERN_RE
I no longer received these errors. However, I am now receiving the
following error.
uninitialized constant REXML::DTD::EntityDecl::PATTERN_RE
When I look at the code in entitydecl.rb I see the following line;
md = source.match( PATTERN_RE, true )
However PATTERN_RE is not declared or intialized in the entitydecl.rb file.
Am I implementing the library wrong or is this code still bugged?
Any help is much appreciated.
Below is a snapshot of how I am trying to use this library.
#!/usr/bin/ruby -dw
require "rexml/dtd/dtd"
require "pathname"
dtdarg = ARGV[0]
def dtdparse(dtdfile)
path = Pathname::new(dtdfile)
if path.relative? then
dtdfile = File::expand_path(dtdfile)
end
dtddata = REXML::DTD::Parser::parse(dtdfile)
puts dtddata
end
dtdparse(dtdarg)
I have had the same problems using the dtd parsing section of rexml. I
got past all the errors only to find that it's not really parsing all
parts of the dtd. The parse_helper isn't even written quite correctly as
a parser -- it ends up catching only the ElementDeclarations, then
possibly a few things after the last ElementDeclaration. Anyway, it
looks like it's not a fully-written feature of rexml yet. I decided
since I need it I'll have to write my own ruby DTD-parser. I might be
putting it on github as a gem (check back at dcparker (Daniel Parker) · GitHub
later).
By the way, does ANYBODY out there know of a real dtd parser in ruby? I
need one that will parse a dtd and actually understand the lists of
attributes and child elements and such. (If none show up, watch for
mine, I probably won't post it to this list, but it'll be on github.)
~Daniel
Nathan Taylor wrote:
···
I seem to have some personal confusion with how to correctly utilize the
rexml/dtd library. I am using ruby version 1.8.6 and when I orginally
tried
to use the code I received some unknown method errors. I modified the
code
in the case statement contained in dtd.rb from the notation
when ElementDecl.PATTERN_RE
to when ElementDecl::PATTERN_RE
I no longer received these errors. However, I am now receiving the
following error.
uninitialized constant REXML::DTD::EntityDecl::PATTERN_RE
When I look at the code in entitydecl.rb I see the following line;
md = source.match( PATTERN_RE, true )
However PATTERN_RE is not declared or intialized in the entitydecl.rb
file.
Am I implementing the library wrong or is this code still bugged?
Any help is much appreciated.
Below is a snapshot of how I am trying to use this library.
#!/usr/bin/ruby -dw
require "rexml/dtd/dtd"
require "pathname"
dtdarg = ARGV[0]
def dtdparse(dtdfile)
path = Pathname::new(dtdfile)
if path.relative? then
dtdfile = File::expand_path(dtdfile)
end
dtddata = REXML::DTD::Parser::parse(dtdfile)
puts dtddata
end
dtdparse(dtdarg)
--
Posted via http://www.ruby-forum.com/\.