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
8 # === Methods extending SAX2
10 # These methods are certainly going to change, until DTDs are fully
11 # supported. Be aware of this.
27 def start_prefix_mapping prefix, uri
29 def end_prefix_mapping prefix
31 def start_element uri, localname, qname, attributes
33 def end_element uri, localname, qname
37 def processing_instruction target, data
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
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
52 def attlistdecl(element, pairs, contents)
55 def elementdecl content
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
76 def notationdecl content
78 # Called when <![CDATA[ ... ]]> is encountered in a document.
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
90 # Called when a comment is encountered.
91 # @p comment The content of the comment