Class: REXML::AttlistDecl (Ruby 2.2.2)
Description: Class : REXML::AttlistDecl - Ruby 2.2.2

- Home
- Core 2.2.2
- Std-lib 2.2.2
- Downloads

Support for the Ruby 2.2 series has ended. See here for reference.

### Home Classes Methods

### In Files

- rexml/attlistdecl.rb

### Parent

Child

### Methods

- ::new
- #[]
- #each
- #include?
- #node_type
- #write

### Included Modules

- Enumerable

### Class/Module Index

Quicksearch

- Array
- Fixnum
- Float
- Object
- REXML
- REXML::AttlistDecl
- REXML::Attribute
- REXML::Attributes
- REXML::CData
- REXML::Child
- REXML::Comment
- REXML::DTD
- REXML::DTD::AttlistDecl
- REXML::DTD::ElementDecl
- REXML::DTD::EntityDecl
- REXML::DTD::NotationDecl
- REXML::DTD::Parser
- REXML::Declaration
- REXML::DocType
- REXML::Document
- REXML::Element
- REXML::ElementDecl
- REXML::Elements
- REXML::Encoding
- REXML::Entity
- REXML::EntityConst
- REXML::ExternalEntity
- REXML::Formatters
- REXML::Formatters::Default
- REXML::Formatters::Pretty
- REXML::Formatters::Transitive
- REXML::Functions
- REXML::IOSource
- REXML::Instruction
- REXML::Light
- REXML::Light::Node
- REXML::Namespace
- REXML::Node
- REXML::NotationDecl
- REXML::Output
- REXML::Parent
- REXML::ParseException
- REXML::Parsers
- REXML::Parsers::BaseParser
- REXML::Parsers::LightParser
- REXML::Parsers::PullEvent
- REXML::Parsers::PullParser
- REXML::Parsers::SAX2Parser
- REXML::Parsers::StreamParser
- REXML::Parsers::TreeParser
- REXML::Parsers::UltraLightParser
- REXML::Parsers::XPathParser
- REXML::QuickPath
- REXML::SAX2Listener
- REXML::Security
- REXML::Source
- REXML::SourceFactory
- REXML::StreamListener
- REXML::SyncEnumerator
- REXML::Text
- REXML::UndefinedNamespaceException
- REXML::Validation
- REXML::Validation::Choice
- REXML::Validation::Event
- REXML::Validation::Interleave
- REXML::Validation::OneOrMore
- REXML::Validation::Optional
- REXML::Validation::Ref
- REXML::Validation::RelaxNG
- REXML::Validation::Sequence
- REXML::Validation::State
- REXML::Validation::ValidationException
- REXML::Validation::Validator
- REXML::Validation::ZeroOrMore
- REXML::XMLDecl
- REXML::XMLTokens
- REXML::XPath
- REXML::XPathParser
- Symbol

No matching classes.

# REXML::AttlistDecl

This class needs:

- Documentation

- Work! Not all types of attlists are intelligently parsed, so we just

spew back out what we get in. This works, but it would be better if we formatted the output ourselves.

AttlistDecls provide just enough support to allow namespace declarations. If you need some sort of generalized support, or have an interesting idea about how to map the hideous, terrible design of DTD AttlistDecls onto an intuitive Ruby interface, let me know. I'm desperate for anything to make DTDs more palateable.

### Attributes

element_name[R]

What is this? Got me.

### Public Class Methods

new(source) click to toggle source

Create an AttlistDecl, pulling the information from a Source. Notice that this isn't very convenient; to create an AttlistDecl, you basically have to format it yourself, and then have the initializer parse it. Sorry, but for the forseeable future, DTD support in REXML is pretty weak on convenience. Have I mentioned how much I hate DTDs?

                   # File rexml/attlistdecl.rb, line 28
    def initialize(source)
      super()
      if (source.kind_of? Array)
        @element_name, @pairs, @contents = *source
      end
    end

### Public Instance Methods

[](key) click to toggle source

Access the attlist attribute/value pairs.

    value = attlist_decl[ attribute_name ]

                   # File rexml/attlistdecl.rb, line 37
    def [](key)
      @pairs[key]
    end

each(&block) click to toggle source

Iterate over the key/value pairs:

    attlist_decl.each { |attribute_name, attribute_value| ... }

                   # File rexml/attlistdecl.rb, line 49
    def each(&block)
      @pairs.each(&block)
    end

include?(key) click to toggle source

Whether an attlist declaration includes the given attribute definition

    if attlist_decl.include? "xmlns:foobar"

                   # File rexml/attlistdecl.rb, line 43
    def include?(key)
      @pairs.keys.include? key
    end

node_type() click to toggle source

                   # File rexml/attlistdecl.rb, line 58
    def node_type
      :attlistdecl
    end

write(out, indent=-1) click to toggle source

Write out exactly what we got in.

                   # File rexml/attlistdecl.rb, line 54
    def write out, indent=-1
      out << @contents
    end