Sha256: b06e85a02ccecc1fb986e85febbdeee19cb4828931fe86888e31d6e9e1106d8f

Contents?: true

Size: 1.21 KB

Versions: 242

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: false
require_relative "elementdecl"
require_relative "entitydecl"
require_relative "../comment"
require_relative "notationdecl"
require_relative "attlistdecl"
require_relative "../parent"

module REXML
  module DTD
    class Parser
      def Parser.parse( input )
        case input
        when String
          parse_helper input
        when File
          parse_helper input.read
        end
      end

      # Takes a String and parses it out
      def Parser.parse_helper( input )
        contents = Parent.new
        while input.size > 0
          case input
          when ElementDecl.PATTERN_RE
            match = $&
            contents << ElementDecl.new( match )
          when AttlistDecl.PATTERN_RE
            matchdata = $~
            contents << AttlistDecl.new( matchdata )
          when EntityDecl.PATTERN_RE
            matchdata = $~
            contents << EntityDecl.new( matchdata )
          when Comment.PATTERN_RE
            matchdata = $~
            contents << Comment.new( matchdata )
          when NotationDecl.PATTERN_RE
            matchdata = $~
            contents << NotationDecl.new( matchdata )
          end
        end
        contents
      end
    end
  end
end

Version data entries

242 entries across 235 versions & 36 rubygems

Version Path
docspring-3.0.0 vendor/bundle/ruby/3.3.0/gems/rexml-3.4.0/lib/rexml/dtd/dtd.rb
rexml-3.4.1 lib/rexml/dtd/dtd.rb
tailscale_middleware-0.0.3 vendor/cache/ruby/3.4.0/gems/rexml-3.4.0/lib/rexml/dtd/dtd.rb
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/rexml-3.3.2/lib/rexml/dtd/dtd.rb
brakeman-7.0.0 bundle/ruby/3.1.0/gems/rexml-3.4.0/lib/rexml/dtd/dtd.rb
rexml-3.4.0 lib/rexml/dtd/dtd.rb
cloudsmith-api-2.0.16 vendor/bundle/ruby/2.6.0/gems/rexml-3.3.9/lib/rexml/dtd/dtd.rb
rexml-3.3.9 lib/rexml/dtd/dtd.rb
brakeman-6.2.2 bundle/ruby/3.1.0/gems/rexml-3.3.8/lib/rexml/dtd/dtd.rb
brakeman-6.2.2.rc1 bundle/ruby/3.3.0/gems/rexml-3.3.8/lib/rexml/dtd/dtd.rb
cloudsmith-api-2.0.15 vendor/bundle/ruby/2.6.0/gems/rexml-3.3.8/lib/rexml/dtd/dtd.rb
cloudsmith-api-2.0.14 vendor/bundle/ruby/2.6.0/gems/rexml-3.3.8/lib/rexml/dtd/dtd.rb
rexml-3.3.8 lib/rexml/dtd/dtd.rb
rexml-3.3.7 lib/rexml/dtd/dtd.rb
brakeman-6.2.1 bundle/ruby/3.1.0/gems/rexml-3.3.6/lib/rexml/dtd/dtd.rb
brakeman-6.2.0 bundle/ruby/3.1.0/gems/rexml-3.3.6/lib/rexml/dtd/dtd.rb
rexml-3.3.6 lib/rexml/dtd/dtd.rb
rexml-3.3.5 lib/rexml/dtd/dtd.rb
rexml-3.3.4 lib/rexml/dtd/dtd.rb
rexml-3.3.3 lib/rexml/dtd/dtd.rb