Class REXML::AttlistDecl
In: lib/rexml/attlistdecl.rb
Parent: Child

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.

Methods

[]   each   include?   new   node_type   write  

Included Modules

Enumerable

Attributes

element_name  [R]  What is this? Got me.

Public Class methods

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?

[Source]

    # File lib/rexml/attlistdecl.rb, line 28
28:                 def initialize(source)
29:                         super()
30:                         if (source.kind_of? Array)
31:                                 @element_name, @pairs, @contents = *source
32:                         end
33:                 end

Public Instance methods

Access the attlist attribute/value pairs.

 value = attlist_decl[ attribute_name ]

[Source]

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

Iterate over the key/value pairs:

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

[Source]

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

Whether an attlist declaration includes the given attribute definition

 if attlist_decl.include? "xmlns:foobar"

[Source]

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

[Source]

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

Write out exactly what we got in.

[Source]

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

[Validate]