Sha256: 2b25bf64b20c467dea07feac7754c2875e9c111caad46b440b79029b15721903

Contents?: true

Size: 1.02 KB

Versions: 8

Compression:

Stored size: 1.02 KB

Contents

module Nokogiri
  module XML
    class DTD < Node
      
      def elements # :nodoc:
        internal_attributes :elements
      end

      def entities # :nodoc:
        internal_attributes :entities
      end

      def notations # :nodoc:
        attr_ptr = cstruct[:notations]
        return nil if attr_ptr.null?

        ahash = {}
        proc = lambda do |payload, data, name|
          notation_cstruct = LibXML::XmlNotation.new(payload)
          ahash[name] = Notation.new(notation_cstruct[:name], notation_cstruct[:PublicID],
                                     notation_cstruct[:SystemID])
        end
        LibXML.xmlHashScan(attr_ptr, proc, nil)
        ahash
      end

    private
      def internal_attributes(attr_name) # :nodoc:
        attr_ptr = cstruct[attr_name.to_sym]
        return nil if attr_ptr.null?

        ahash = {}
        proc = lambda do |payload, data, name|
          ahash[name] = Node.wrap(payload)
        end
        LibXML.xmlHashScan(attr_ptr, proc, nil)
        ahash
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
nokogiri-1.3.0-x86-mingw32 lib/nokogiri/ffi/xml/dtd.rb
nokogiri-1.3.0-java lib/nokogiri/ffi/xml/dtd.rb
nokogiri-1.3.0-x86-mswin32 lib/nokogiri/ffi/xml/dtd.rb
nokogiri-1.3.0 lib/nokogiri/ffi/xml/dtd.rb
nokogiri-1.3.1-java lib/nokogiri/ffi/xml/dtd.rb
nokogiri-1.3.1-x86-mingw32 lib/nokogiri/ffi/xml/dtd.rb
nokogiri-1.3.1 lib/nokogiri/ffi/xml/dtd.rb
nokogiri-1.3.1-x86-mswin32 lib/nokogiri/ffi/xml/dtd.rb