Class REXML::DTD::Parser
In: lib/rexml/dtd/dtd.rb
Parent: Object

Methods

Public Class methods

[Source]

    # File lib/rexml/dtd/dtd.rb, line 11
11:                         def Parser.parse( input )
12:                                 case input
13:                                 when String
14:                                         parse_helper input
15:                                 when File
16:                                         parse_helper input.read
17:                                 end
18:                         end

Takes a String and parses it out

[Source]

    # File lib/rexml/dtd/dtd.rb, line 21
21:                         def Parser.parse_helper( input )
22:                                 contents = Parent.new
23:                                 while input.size > 0
24:                                         case input
25:                                         when ElementDecl.PATTERN_RE
26:                                                 match = $&
27:                                                 source = $'
28:                                                 contents << ElementDecl.new( match )
29:                                         when AttlistDecl.PATTERN_RE
30:                                                 matchdata = $~
31:                                                 source = $'
32:                                                 contents << AttlistDecl.new( matchdata )
33:                                         when EntityDecl.PATTERN_RE
34:                                                 matchdata = $~
35:                                                 source = $'
36:                                                 contents << EntityDecl.new( matchdata )
37:                                         when Comment.PATTERN_RE
38:                                                 matchdata = $~
39:                                                 source = $'
40:                                                 contents << Comment.new( matchdata )
41:                                         when NotationDecl.PATTERN_RE
42:                                                 matchdata = $~
43:                                                 source = $'
44:                                                 contents << NotationDecl.new( matchdata )
45:                                         end
46:                                 end
47:                                 contents
48:                         end

[Validate]