PageRenderTime 50ms CodeModel.GetById 41ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/tools/Ruby/lib/ruby/1.8/rexml/sax2listener.rb

http://github.com/agross/netopenspace
Ruby | 97 lines | 38 code | 0 blank | 59 comment | 0 complexity | 88f0ff7d7b0c601a160f3fa40dff0613 MD5 | raw file
 1module REXML
 2	# A template for stream parser listeners.
 3	# Note that the declarations (attlistdecl, elementdecl, etc) are trivially
 4	# processed; REXML doesn't yet handle doctype entity declarations, so you 
 5	# have to parse them out yourself.
 6	# === Missing methods from SAX2
 7	#  ignorable_whitespace
 8	# === Methods extending SAX2 
 9	# +WARNING+
10	# These methods are certainly going to change, until DTDs are fully
11	# supported.  Be aware of this.
12	#  start_document
13	#  end_document
14	#  doctype
15	#  elementdecl
16	#  attlistdecl
17	#  entitydecl
18	#  notationdecl
19	#  cdata
20	#  xmldecl
21	#  comment
22	module SAX2Listener
23		def start_document
24		end
25		def end_document
26		end
27		def start_prefix_mapping prefix, uri
28		end
29		def end_prefix_mapping prefix
30		end
31		def start_element uri, localname, qname, attributes
32		end
33		def end_element uri, localname, qname
34		end
35		def characters text
36		end
37		def processing_instruction target, data
38		end
39		# Handles a doctype declaration. Any attributes of the doctype which are
40		# not supplied will be nil.  # EG, <!DOCTYPE me PUBLIC "foo" "bar">
41		# @p name the name of the doctype; EG, "me"
42		# @p pub_sys "PUBLIC", "SYSTEM", or nil.  EG, "PUBLIC"
43		# @p long_name the supplied long name, or nil.  EG, "foo"
44		# @p uri the uri of the doctype, or nil.  EG, "bar"
45		def doctype name, pub_sys, long_name, uri
46		end
47		# If a doctype includes an ATTLIST declaration, it will cause this
48		# method to be called.  The content is the declaration itself, unparsed.
49		# EG, <!ATTLIST el attr CDATA #REQUIRED> will come to this method as "el
50		# attr CDATA #REQUIRED".  This is the same for all of the .*decl
51		# methods.
52		def attlistdecl(element, pairs, contents)
53		end
54		# <!ELEMENT ...>
55		def elementdecl content
56		end
57		# <!ENTITY ...>
58		# The argument passed to this method is an array of the entity
59		# declaration.  It can be in a number of formats, but in general it
60		# returns (example, result):
61		#  <!ENTITY % YN '"Yes"'>  
62		#  ["%", "YN", "'\"Yes\"'", "\""]
63		#  <!ENTITY % YN 'Yes'>
64		#  ["%", "YN", "'Yes'", "s"]
65		#  <!ENTITY WhatHeSaid "He said %YN;">
66		#  ["WhatHeSaid", "\"He said %YN;\"", "YN"]
67		#  <!ENTITY open-hatch SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml">
68		#  ["open-hatch", "SYSTEM", "\"http://www.textuality.com/boilerplate/OpenHatch.xml\""]
69		#  <!ENTITY open-hatch PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN" "http://www.textuality.com/boilerplate/OpenHatch.xml">
70		#  ["open-hatch", "PUBLIC", "\"-//Textuality//TEXT Standard open-hatch boilerplate//EN\"", "\"http://www.textuality.com/boilerplate/OpenHatch.xml\""]
71		#  <!ENTITY hatch-pic SYSTEM "../grafix/OpenHatch.gif" NDATA gif>
72		#  ["hatch-pic", "SYSTEM", "\"../grafix/OpenHatch.gif\"", "\n\t\t\t\t\t\t\tNDATA gif", "gif"]
73		def entitydecl name, decl
74		end
75		# <!NOTATION ...>
76		def notationdecl content
77		end
78		# Called when <![CDATA[ ... ]]> is encountered in a document.
79		# @p content "..."
80		def cdata content
81		end
82		# Called when an XML PI is encountered in the document.
83		# EG: <?xml version="1.0" encoding="utf"?>
84		# @p version the version attribute value.  EG, "1.0"
85		# @p encoding the encoding attribute value, or nil.  EG, "utf"
86		# @p standalone the standalone attribute value, or nil.  EG, nil
87    # @p spaced the declaration is followed by a line break
88		def xmldecl version, encoding, standalone
89		end
90		# Called when a comment is encountered.
91		# @p comment The content of the comment
92		def comment comment
93		end
94    def progress position
95    end
96	end	
97end