Class: XML::Parser::SAXDriver::SAXParser

Inherits:
XML::Parser show all
Includes:
SAX::Locator
Defined in:
lib/xml/saxdriver.rb

Overview

All parser events are delegated to SAXDriver

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ SAXParser

Returns a new instance of SAXParser.



78
79
80
81
82
83
84
85
# File 'lib/xml/saxdriver.rb', line 78

def initialize(*args)
  super(*args)
  @publicId = nil
  @systemId = nil
  if self.respond_to?(:setParamEntityParsing)
    self.setParamEntityParsing(PARAM_ENTITY_PARSING_UNLESS_STANDALONE)
  end
end

Class Method Details

.new(saxdriver, *rest) ⇒ Object



72
73
74
75
76
# File 'lib/xml/saxdriver.rb', line 72

def SAXParser.new(saxdriver, *rest)
  obj = super(*rest)
  obj.setDriver(saxdriver)
  obj
end

Instance Method Details

#character(data) ⇒ Object



123
124
125
# File 'lib/xml/saxdriver.rb', line 123

def character(data)
  @saxdriver.character(data)
end

#comment(data) ⇒ Object



139
140
# File 'lib/xml/saxdriver.rb', line 139

def comment(data)
end

#endElement(name) ⇒ Object



119
120
121
# File 'lib/xml/saxdriver.rb', line 119

def endElement(name)
  @saxdriver.endElement(name)
end

#externalEntityRef(context, base, systemId, publicId) ⇒ Object



142
143
144
145
146
147
148
149
150
151
152
# File 'lib/xml/saxdriver.rb', line 142

def externalEntityRef(context, base, systemId, publicId)
  inputSource = @saxdriver.xmlOpen(base, systemId, publicId)
  encoding = inputSource.getEncoding
  if encoding
    parser = SAXParser.new(@saxdriver, self, context, encoding)
  else
    parser = SAXParser.new(@saxdriver, self, context)
  end
  parser.parse(inputSource)
  parser.done
end

#getColumnNumberObject



111
112
113
# File 'lib/xml/saxdriver.rb', line 111

def getColumnNumber
  self.column
end

#getLineNumberObject



107
108
109
# File 'lib/xml/saxdriver.rb', line 107

def getLineNumber
  self.line
end

#getPublicIdObject



99
100
101
# File 'lib/xml/saxdriver.rb', line 99

def getPublicId
  @publicId
end

#getSystemIdObject



103
104
105
# File 'lib/xml/saxdriver.rb', line 103

def getSystemId
  @systemId
end

#notationDecl(name, base, sysid, pubid) ⇒ Object



131
132
133
# File 'lib/xml/saxdriver.rb', line 131

def notationDecl(name, base, sysid, pubid)
  @saxdriver.notationDecl(name, base, sysid, pubid)
end

#parse(inputSource) ⇒ Object



91
92
93
94
95
96
97
# File 'lib/xml/saxdriver.rb', line 91

def parse(inputSource)
  @systemId = inputSource.getSystemId
  @saxdriver.pushLocator(self)
  setBase(@systemId)
  super(inputSource.getByteStream.read)
  @saxdriver.popLocator
end

#processingInstruction(target, data) ⇒ Object



127
128
129
# File 'lib/xml/saxdriver.rb', line 127

def processingInstruction(target, data)
  @saxdriver.processingInstruction(target, data)
end

#setDriver(saxdriver) ⇒ Object



87
88
89
# File 'lib/xml/saxdriver.rb', line 87

def setDriver(saxdriver)
  @saxdriver = saxdriver
end

#startElement(name, attr) ⇒ Object



115
116
117
# File 'lib/xml/saxdriver.rb', line 115

def startElement(name, attr)
  @saxdriver.startElement(name, attr)
end

#unparsedEntityDecl(name, base, sysid, pubid, notation) ⇒ Object



135
136
137
# File 'lib/xml/saxdriver.rb', line 135

def unparsedEntityDecl(name, base, sysid, pubid, notation)
  @saxdriver.unparsedEntityDecl(name, base, sysid, pubid, notation)
end