D
Daniel Harple
(1) How does one parse a doctype in REXML?
Hack solution --
#+++++++
require 'rexml/document'
data =<<EOF
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE Resource SYSTEM "foo.dtd">
<Resource>
<bar>baz</bar>
</Resource>
EOF
p REXML:ocument.new(data).doctype.instance_variable_get
("@long_name")[1..-2] # => "foo.dtd"
#+++++++
There must be a simple solution I am missing, what is it?
(2) In rexml/dtd/elementdecl, PATTERN_RE is defined twice, issuing a
warning (see http://www.ruby-doc.org/stdlib/libdoc/rexml/rdoc/classes/
REXML/DTD/ElementDecl.html)
(3)
#+++++++
require 'rexml/dtd/dtd'
data =<<EOF
<!ELEMENT foo (bar,baz)>
<!ELEMENT bar (#PCDATA)>
<!ELEMENT baz (#PCDATA)>
EOF
p REXML:TD:arser.parse(data)
# => /opt/local/lib/ruby/1.8/rexml/dtd/elementdecl.rb:8: warning:
already initialized constant PATTERN_RE
# => /opt/local/lib/ruby/1.8/rexml/dtd/dtd.rb:25:in `parse_helper':
undefined method `PATTERN_RE' for REXML:TD::ElementDecl:Class
(NoMethodError)
# => from /opt/local/lib/ruby/1.8/rexml/dtd/dtd.rb:14:in `parse'
#+++++++
-- Daniel
Hack solution --
#+++++++
require 'rexml/document'
data =<<EOF
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE Resource SYSTEM "foo.dtd">
<Resource>
<bar>baz</bar>
</Resource>
EOF
p REXML:ocument.new(data).doctype.instance_variable_get
("@long_name")[1..-2] # => "foo.dtd"
#+++++++
There must be a simple solution I am missing, what is it?
(2) In rexml/dtd/elementdecl, PATTERN_RE is defined twice, issuing a
warning (see http://www.ruby-doc.org/stdlib/libdoc/rexml/rdoc/classes/
REXML/DTD/ElementDecl.html)
(3)
#+++++++
require 'rexml/dtd/dtd'
data =<<EOF
<!ELEMENT foo (bar,baz)>
<!ELEMENT bar (#PCDATA)>
<!ELEMENT baz (#PCDATA)>
EOF
p REXML:TD:arser.parse(data)
# => /opt/local/lib/ruby/1.8/rexml/dtd/elementdecl.rb:8: warning:
already initialized constant PATTERN_RE
# => /opt/local/lib/ruby/1.8/rexml/dtd/dtd.rb:25:in `parse_helper':
undefined method `PATTERN_RE' for REXML:TD::ElementDecl:Class
(NoMethodError)
# => from /opt/local/lib/ruby/1.8/rexml/dtd/dtd.rb:14:in `parse'
#+++++++
-- Daniel