Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > REXML -- Parsing doctypes (and some some bugs)

Reply
Thread Tools

REXML -- Parsing doctypes (and some some bugs)

 
 
Daniel Harple
Guest
Posts: n/a
 
      12-23-2005
(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_variabl e_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/libdo.../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





 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
including xml entities with their own doctypes the.computational biologist XML 5 07-23-2011 06:08 PM
IE & Doctypes (esp for newbies) UKuser HTML 2 02-04-2009 02:25 PM
Mixing doctypes JWL HTML 5 10-16-2006 08:50 AM
Comments and DOCTYPES Wendy Shuya XML 2 04-02-2004 02:11 PM
soap4r 1.4.8.1 with REXML 2.7.1 - no REXML::VERSION_MAJOR Damphyr Ruby 2 07-16-2003 09:49 AM



Advertisments