PHP 8.2.31
Preview: attlistdecl.rb Size: 1.79 KB
/proc/thread-self/root/opt/alt/ruby18/lib64/ruby/1.8/rexml/attlistdecl.rb

#vim:ts=2 sw=2 noexpandtab:
require 'rexml/child'
require 'rexml/source'

module REXML
	# 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.
	class AttlistDecl < Child
		include Enumerable

		# What is this?  Got me.
		attr_reader :element_name

		# 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?
		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 ]
		def [](key)
			@pairs[key]
		end

		# Whether an attlist declaration includes the given attribute definition
		#  if attlist_decl.include? "xmlns:foobar"
		def include?(key)
			@pairs.keys.include? key
		end

		# Iterate over the key/value pairs:
		#  attlist_decl.each { |attribute_name, attribute_value| ... }
		def each(&block)
			@pairs.each(&block)
		end

		# Write out exactly what we got in.
		def write out, indent=-1
			out << @contents
		end

		def node_type
			:attlistdecl
		end
	end
end

Directory Contents

Dirs: 6 × Files: 29

Name Size Perms Modified Actions
dtd DIR
- drwxr-xr-x 2024-03-03 22:48:14
Edit Download
encodings DIR
- drwxr-xr-x 2024-03-03 22:48:14
Edit Download
- drwxr-xr-x 2024-03-03 22:48:14
Edit Download
light DIR
- drwxr-xr-x 2024-03-03 22:48:14
Edit Download
parsers DIR
- drwxr-xr-x 2024-03-03 22:48:14
Edit Download
- drwxr-xr-x 2024-03-03 22:48:14
Edit Download
1.79 KB lrw-r--r-- 2008-06-06 08:05:24
Edit Download
5.02 KB lrw-r--r-- 2008-04-18 07:22:13
Edit Download
1.44 KB lrw-r--r-- 2008-04-18 07:22:13
Edit Download
2.46 KB lrw-r--r-- 2007-02-12 23:01:19
Edit Download
2.00 KB lrw-r--r-- 2008-04-18 07:22:13
Edit Download
6.64 KB lrw-r--r-- 2008-04-18 07:22:13
Edit Download
7.93 KB lrw-r--r-- 2013-05-18 14:55:14
Edit Download
43.24 KB lrw-r--r-- 2009-11-25 07:37:40
Edit Download
2.08 KB lrw-r--r-- 2008-04-18 07:22:13
Edit Download
4.85 KB lrw-r--r-- 2009-02-05 00:03:56
Edit Download
10.80 KB lrw-r--r-- 2008-06-06 08:05:24
Edit Download
1.90 KB lrw-r--r-- 2008-04-18 07:22:13
Edit Download
1018 B lrw-r--r-- 2007-02-12 23:01:19
Edit Download
1.93 KB lrw-r--r-- 2008-04-18 07:37:32
Edit Download
385 B lrw-r--r-- 2007-02-12 23:01:19
Edit Download
4.40 KB lrw-r--r-- 2007-02-12 23:01:19
Edit Download
1.20 KB lrw-r--r-- 2007-02-12 23:01:19
Edit Download
7.65 KB lrw-r--r-- 2007-02-12 23:01:19
Edit Download
1.71 KB lrw-r--r-- 2013-05-18 14:55:14
Edit Download
3.45 KB lrw-r--r-- 2007-02-12 23:01:19
Edit Download
7.06 KB lrw-r--r-- 2008-04-18 07:22:13
Edit Download
3.71 KB lrw-r--r-- 2007-02-12 23:01:19
Edit Download
721 B lrw-r--r-- 2007-02-12 23:01:19
Edit Download
11.15 KB lrw-r--r-- 2013-05-18 14:55:14
Edit Download
210 B lrw-r--r-- 2008-04-18 07:22:13
Edit Download
2.65 KB lrw-r--r-- 2008-04-18 07:22:13
Edit Download
506 B lrw-r--r-- 2007-02-12 23:01:19
Edit Download
2.39 KB lrw-r--r-- 2008-06-06 08:05:24
Edit Download
25.15 KB lrw-r--r-- 2008-04-18 07:22:13
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).