| Class | REXML::AttlistDecl |
| In: |
rexml/attlistdecl.rb
|
| Parent: | Child |
This class needs:
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.
| element_name | [R] | What is this? Got me. |
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
Access the attlist attribute/value pairs.
value = attlist_decl[ attribute_name ]
# File rexml/attlistdecl.rb, line 37 def [](key) @pairs[key] end
Itterate 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
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
ruby-doc.org is hosted and run by James Britt and Happy Camper Studios, a Ruby application development company in Phoenix, Arizona. Ruby-doc.org was created in 2002 to promote the Ruby language and to help other Ruby hackers.
Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.
For more information on the Ruby programming language, visit ruby-lang.org.
Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.