Class XSD::XMLParser::Nokogiri inherits from XSD::XMLParser::Parser
Nokogiri XML parser for soap4r.
Nokogiri may be used as the XML parser in soap4r. Simply require ‘xsd/xmlparser/nokogiri’ in your soap4r applications, and soap4r will use Nokogiri as it’s XML parser. No other changes should be required to use Nokogiri as the XML parser.
Example (using UW ITS Web Services):
require 'rubygems'
require 'nokogiri'
gem 'soap4r'
require 'defaultDriver'
require 'xsd/xmlparser/nokogiri'
obj = AvlPortType.new
obj.getLatestByRoute(obj.getAgencies.first, 8).each do |bus|
p "#{bus.routeID}, #{bus.longitude}, #{bus.latitude}"
end
Public Class Methods
- new(host, opt = {}) Show Source
Create a new XSD parser with host and opt
-
# File lib/xsd/xmlparser/nokogiri.rb, line 29 29: def initialize host, opt = {} 30: super 31: @parser = ::Nokogiri::XML::SAX::Parser.new(self, @charset || 'UTF-8') 32: end
Public Instance Methods
- cdata_block(string) Show Source
Handle cdata_blocks containing string
-
# File lib/xsd/xmlparser/nokogiri.rb, line 61 61: def cdata_block string 62: characters string 63: end
- do_parse(string_or_readable) Show Source
Start parsing string_or_readable
-
# File lib/xsd/xmlparser/nokogiri.rb, line 36 36: def do_parse string_or_readable 37: @parser.parse(string_or_readable) 38: end
- end_element(name) Show Source
Handle the end_element event with name
-
# File lib/xsd/xmlparser/nokogiri.rb, line 48 48: def end_element name 49: super 50: end
- end_element_namespace(name, prefix = nil, uri = nil) Show Source
-
# File lib/xsd/xmlparser/nokogiri.rb, line 77 77: def end_element_namespace name, prefix = nil, uri = nil 78: ### 79: # Deal with SAX v1 interface 80: end_element [prefix, name].compact.join(':') 81: end
- error(msg) Show Source
Handle errors with message msg
-
# File lib/xsd/xmlparser/nokogiri.rb, line 54 54: def error msg 55: raise ParseError.new(msg) 56: end
- start_element(name, attrs = []) Show Source
Handle the start_element event with name and attrs
-
# File lib/xsd/xmlparser/nokogiri.rb, line 42 42: def start_element name, attrs = [] 43: super(name, Hash[*attrs.flatten]) 44: end
- start_element_namespace(name, attrs = [], prefix = nil, uri = nil, ns = []) Show Source
-
# File lib/xsd/xmlparser/nokogiri.rb, line 65 65: def start_element_namespace name, attrs = [], prefix = nil, uri = nil, ns = [] 66: ### 67: # Deal with SAX v1 interface 68: name = [prefix, name].compact.join(':') 69: attributes = ns.map { |ns_prefix,ns_uri| 70: [['xmlns', ns_prefix].compact.join(':'), ns_uri] 71: } + attrs.map { |attr| 72: [[attr.prefix, attr.localname].compact.join(':'), attr.value] 73: }.flatten 74: start_element name, attributes 75: end