class XSD::XMLParser::Nokogiri
end
p “#{bus.routeID}, #{bus.longitude}, #{bus.latitude}”
obj.getLatestByRoute(obj.getAgencies.first, 8).each do |bus|
obj = AvlPortType.new
require ‘xsd/xmlparser/nokogiri’
require ‘defaultDriver’
gem ‘soap4r’
require ‘nokogiri’
require ‘rubygems’
Example (using UW ITS Web Services):
required to use Nokogiri as the XML parser.
will use Nokogiri as it’s XML parser. No other changes should be
’xsd/xmlparser/nokogiri’ in your soap4r applications, and soap4r
Nokogiri may be used as the XML parser in soap4r. Simply require
Nokogiri XML parser for soap4r.
##
def cdata_block(string)
##
def cdata_block(string) characters(string) end
def do_parse(string_or_readable)
##
def do_parse(string_or_readable) @parser.parse(string_or_readable) end
def end_element(name)
##
def end_element(name) super end
def end_element_namespace(name, prefix = nil, uri = nil)
+prefix+ is the namespace prefix associated with the element
+name+ is the element's name
Called at the end of an element
##
def end_element_namespace(name, prefix = nil, uri = nil) ### # Deal with SAX v1 interface end_element([prefix, name].compact.join(":")) end
def error(msg)
##
def error(msg) raise ParseError, msg end
def initialize(host, opt = {})
##
def initialize(host, opt = {}) super @parser = ::Nokogiri::XML::SAX::Parser.new(self, @charset || "UTF-8") end
def start_element(name, attrs = [])
##
def start_element(name, attrs = []) super(name, Hash[*attrs.flatten]) end
def start_element_namespace(name, attrs = [], prefix = nil, uri = nil, ns = []) # rubocop:disable Metrics/ParameterLists
+ns+ is a hash of namespace prefix:urls associated with the element
+uri+ is the associated namespace URI
+prefix+ is the namespace prefix for the element
+attrs+ is a list of attributes
+name+ is the element name
Called at the beginning of an element
##
def start_element_namespace(name, attrs = [], prefix = nil, uri = nil, ns = []) # rubocop:disable Metrics/ParameterLists ### # Deal with SAX v1 interface name = [prefix, name].compact.join(":") attributes = ns.map do |ns_prefix, ns_uri| [["xmlns", ns_prefix].compact.join(":"), ns_uri] end + attrs.map do |attr| [[attr.prefix, attr.localname].compact.join(":"), attr.value] end.flatten start_element(name, attributes) end