Class WSDL::XMLSchema::Parser
In: wsdl/xmlSchema/parser.rb
Parent: Object

Methods

Included Modules

XSD

Classes and Modules

Class WSDL::XMLSchema::Parser::AttributeConstraintError
Class WSDL::XMLSchema::Parser::ElementConstraintError
Class WSDL::XMLSchema::Parser::FormatDecodeError
Class WSDL::XMLSchema::Parser::ParseError
Class WSDL::XMLSchema::Parser::ParseFrame
Class WSDL::XMLSchema::Parser::UnexpectedElementError
Class WSDL::XMLSchema::Parser::UnknownAttributeError
Class WSDL::XMLSchema::Parser::UnknownElementError

Public Class methods

[Source]

# File wsdl/xmlSchema/parser.rb, line 50
  def initialize(opt = {})
    @parser = XSD::XMLParser.create_parser(self, opt)
    @parsestack = nil
    @lastnode = nil
    @ignored = {}
    @location = opt[:location]
    @originalroot = opt[:originalroot]
  end

Public Instance methods

[Source]

# File wsdl/xmlSchema/parser.rb, line 86
  def characters(text)
    lastframe = @parsestack.last
    if lastframe
      # Need not to be cloned because character does not have attr.
      ns = lastframe.ns
      decode_text(ns, text)
    else
      p text if $DEBUG
    end
  end

[Source]

# File wsdl/xmlSchema/parser.rb, line 67
  def charset
    @parser.charset
  end

[Source]

# File wsdl/xmlSchema/parser.rb, line 97
  def end_element(name)
    lastframe = @parsestack.pop
    unless name == lastframe.name
      raise UnexpectedElementError.new("closing element name '#{name}' does not match with opening element '#{lastframe.name}'")
    end
    decode_tag_end(lastframe.ns, lastframe.node)
    @lastnode = lastframe.node
  end

[Source]

# File wsdl/xmlSchema/parser.rb, line 59
  def parse(string_or_readable)
    @parsestack = []
    @lastnode = nil
    @textbuf = ''
    @parser.do_parse(string_or_readable)
    @lastnode
  end

[Source]

# File wsdl/xmlSchema/parser.rb, line 71
  def start_element(name, attrs)
    lastframe = @parsestack.last
    ns = parent = nil
    if lastframe
      ns = lastframe.ns.clone_ns
      parent = lastframe.node
    else
      ns = XSD::NS.new
      parent = nil
    end
    attrs = XSD::XMLParser.filter_ns(ns, attrs)
    node = decode_tag(ns, name, attrs, parent)
    @parsestack << ParseFrame.new(ns, name, node)
  end

[Validate]