Module: WSDL::SOAP::MappingRegistryCreatorSupport

### Home Classes Methods

### In Files

- lib/wsdl/soap/mappingRegistryCreatorSupport.rb

### Methods

- #create_array_element_definition
- #define_attribute
- #define_dump_class
- #dump_array_typemap
- #dump_complex_typemap
- #dump_complextypedef
- #dump_encoded_array_typemap
- #dump_entry
- #dump_entry_item
- #dump_literal_array_typemap
- #dump_occurrence
- #dump_schema_element
- #dump_schema_element_definition
- #dump_simple_typemap
- #dump_simpletypedef
- #dump_simpletypedef_list
- #dump_simpletypedef_restriction
- #dump_simpletypedef_union
- #dump_type
- #dump_with_inner
- #parse_elements

### Included Modules

- WSDL::SOAP::ClassDefCreatorSupport
- XSD::CodeGen

### Files

- README.rdoc

### Class/Module Index

Quicksearch

- SOAP
- SOAP::ArrayIndexOutOfBoundsError
- SOAP::ArrayStoreError
- SOAP::Attachment
- SOAP::AttrProxy
- SOAP::AttrProxy::AttrProxyClassSupport
- SOAP::EmptyResponseError
- SOAP::EncodingStyle
- SOAP::EncodingStyle::ASPDotNetHandler
- SOAP::EncodingStyle::ASPDotNetHandler::SOAPTemporalObject
- SOAP::EncodingStyle::ASPDotNetHandler::SOAPUnknown
- SOAP::EncodingStyle::Handler
- SOAP::EncodingStyle::Handler::EncodingStyleError
- SOAP::EncodingStyle::LiteralHandler
- SOAP::EncodingStyle::SOAPHandler
- SOAP::EncodingStyle::SOAPHandler::SOAPTemporalObject
- SOAP::EncodingStyle::SOAPHandler::SOAPUnknown
- SOAP::Env
- SOAP::Error
- SOAP::FaultCode
- SOAP::FaultError
- SOAP::Filter
- SOAP::Filter::FilterChain
- SOAP::Filter::Handler
- SOAP::Filter::StreamHandler
- SOAP::Generator
- SOAP::Generator::FormatEncodeError
- SOAP::HTTPConfigLoader
- SOAP::HTTPStreamError
- SOAP::HTTPStreamHandler
- SOAP::HTTPStreamHandler::Client
- SOAP::HTTPStreamHandler::HttpPostRequestFilter
- SOAP::Header
- SOAP::Header::Handler
- SOAP::Header::HandlerSet
- SOAP::Header::MappingHandler
- SOAP::Header::SimpleHandler
- SOAP::MIMEMessage
- SOAP::MIMEMessage::Header
- SOAP::MIMEMessage::Headers
- SOAP::MIMEMessage::MIMEMessageError
- SOAP::MIMEMessage::Part
- SOAP::MPostUnavailableError
- SOAP::Mapping
- SOAP::Mapping::ArrayFactory_
- SOAP::Mapping::AttachmentFactory
- SOAP::Mapping::Base64Factory_
- SOAP::Mapping::BasetypeFactory_
- SOAP::Mapping::DateTimeFactory_
- SOAP::Mapping::EncodedRegistry
- SOAP::Mapping::EncodedRegistry::Map
- SOAP::Mapping::Factory
- SOAP::Mapping::FixnumFactory_
- SOAP::Mapping::HashFactory_
- SOAP::Mapping::LiteralRegistry
- SOAP::Mapping::MappedException
- SOAP::Mapping::MappingError
- SOAP::Mapping::Object
- SOAP::Mapping::Registry
- SOAP::Mapping::RegistrySupport
- SOAP::Mapping::RubytypeFactory
- SOAP::Mapping::SOAPException
- SOAP::Mapping::SchemaChoiceDefinition
- SOAP::Mapping::SchemaComplexTypeDefinition
- SOAP::Mapping::SchemaDefinition
- SOAP::Mapping::SchemaElementDefinition
- SOAP::Mapping::SchemaEmptyDefinition
- SOAP::Mapping::SchemaSequenceDefinition
- SOAP::Mapping::StringFactory_
- SOAP::Mapping::TraverseSupport
- SOAP::Mapping::TypedArrayFactory_
- SOAP::Mapping::TypedStructFactory_
- SOAP::Mapping::URIFactory_
- SOAP::Mapping::WSDLEncodedRegistry
- SOAP::Mapping::WSDLLiteralRegistry
- SOAP::Marshal
- SOAP::Marshal
- SOAP::Marshallable
- SOAP::NS
- SOAP::NestedException
- SOAP::NetHttpClient
- SOAP::NetHttpClient::Response
- SOAP::NetHttpClient::SessionManager
- SOAP::Parser
- SOAP::Parser::FormatDecodeError
- SOAP::Parser::ParseError
- SOAP::Parser::ParseFrame
- SOAP::Parser::ParseFrame::NodeContainer
- SOAP::Parser::UnexpectedElementError
- SOAP::PostUnavailableError
- SOAP::Processor
- SOAP::Property
- SOAP::Property::Util
- SOAP::RPC
- SOAP::RPC::CGIStub
- SOAP::RPC::CGIStub::SOAPFCGIRequest
- SOAP::RPC::CGIStub::SOAPRequest
- SOAP::RPC::CGIStub::SOAPStdinRequest
- SOAP::RPC::Driver
- SOAP::RPC::HTTPServer
- SOAP::RPC::MethodDef
- SOAP::RPC::MethodDef::Parameter
- SOAP::RPC::MethodDefinitionError
- SOAP::RPC::ParameterError
- SOAP::RPC::Proxy
- SOAP::RPC::Proxy::Operation
- SOAP::RPC::RPCError
- SOAP::RPC::Router
- SOAP::RPC::Router::ApplicationScopeOperation
- SOAP::RPC::Router::Operation
- SOAP::RPC::Router::RequestScopeOperation
- SOAP::RPC::SOAPMethod
- SOAP::RPC::SOAPMethodRequest
- SOAP::RPC::SOAPMethodResponse
- SOAP::RPC::SOAPVoid
- SOAP::RPC::SOAPlet
- SOAP::RPC::StandaloneServer
- SOAP::RPCRoutingError
- SOAP::ResponseFormatError
- SOAP::SOAPAnySimpleType
- SOAP::SOAPAnyURI
- SOAP::SOAPArray
- SOAP::SOAPAttachment
- SOAP::SOAPBase64
- SOAP::SOAPBasetype
- SOAP::SOAPBody
- SOAP::SOAPBoolean
- SOAP::SOAPByte
- SOAP::SOAPCompoundtype
- SOAP::SOAPDate
- SOAP::SOAPDateTime
- SOAP::SOAPDecimal
- SOAP::SOAPDouble
- SOAP::SOAPDuration
- SOAP::SOAPENTITIES
- SOAP::SOAPENTITY
- SOAP::SOAPElement
- SOAP::SOAPEnvelope
- SOAP::SOAPEnvelopeElement
- SOAP::SOAPExternalReference
- SOAP::SOAPFault
- SOAP::SOAPFloat
- SOAP::SOAPGDay
- SOAP::SOAPGMonth
- SOAP::SOAPGMonthDay
- SOAP::SOAPGYear
- SOAP::SOAPGYearMonth
- SOAP::SOAPHeader
- SOAP::SOAPHeaderItem
- SOAP::SOAPHexBinary
- SOAP::SOAPID
- SOAP::SOAPIDREF
- SOAP::SOAPIDREFS
- SOAP::SOAPInt
- SOAP::SOAPInteger
- SOAP::SOAPLanguage
- SOAP::SOAPLong
- SOAP::SOAPModuleUtils
- SOAP::SOAPNCName
- SOAP::SOAPNMTOKEN
- SOAP::SOAPNMTOKENS
- SOAP::SOAPName
- SOAP::SOAPNameAccessible
- SOAP::SOAPNegativeInteger
- SOAP::SOAPNil
- SOAP::SOAPNonNegativeInteger
- SOAP::SOAPNonPositiveInteger
- SOAP::SOAPNormalizedString
- SOAP::SOAPPositiveInteger
- SOAP::SOAPQName
- SOAP::SOAPREXMLElementWrap
- SOAP::SOAPRawData
- SOAP::SOAPRawString
- SOAP::SOAPReference
- SOAP::SOAPShort
- SOAP::SOAPString
- SOAP::SOAPStruct
- SOAP::SOAPTime
- SOAP::SOAPToken
- SOAP::SOAPType
- SOAP::SOAPUnsignedByte
- SOAP::SOAPUnsignedInt
- SOAP::SOAPUnsignedLong
- SOAP::SOAPUnsignedShort
- SOAP::StreamError
- SOAP::StreamHandler
- SOAP::StreamHandler::ConnectionData
- SOAP::UnhandledMustUnderstandHeaderError
- SOAP::WSDLDriverFactory
- SOAP::WSDLDriverFactory::FactoryError
- WSDL
- WSDL::Binding
- WSDL::Definitions
- WSDL::Documentation
- WSDL::Error
- WSDL::Import
- WSDL::Importer
- WSDL::Info
- WSDL::Message
- WSDL::Operation
- WSDL::OperationBinding
- WSDL::OperationBinding::BoundId
- WSDL::OperationBinding::OperationInfo
- WSDL::OperationBinding::Part
- WSDL::Param
- WSDL::Parser
- WSDL::Parser::AttributeConstraintError
- WSDL::Parser::ElementConstraintError
- WSDL::Parser::FormatDecodeError
- WSDL::Parser::ParseError
- WSDL::Parser::ParseFrame
- WSDL::Parser::UnexpectedElementError
- WSDL::Parser::UnknownAttributeError
- WSDL::Parser::UnknownElementError
- WSDL::Part
- WSDL::Port
- WSDL::PortType
- WSDL::SOAP
- WSDL::SOAP::Address
- WSDL::SOAP::Binding
- WSDL::SOAP::Body
- WSDL::SOAP::CGIStubCreator
- WSDL::SOAP::ClassDefCreator
- WSDL::SOAP::ClassDefCreatorSupport
- WSDL::SOAP::ClassNameCreator
- WSDL::SOAP::ClientSkeltonCreator
- WSDL::SOAP::DriverCreator
- WSDL::SOAP::EncodedMappingRegistryCreator
- WSDL::SOAP::Fault
- WSDL::SOAP::Header
- WSDL::SOAP::HeaderFault
- WSDL::SOAP::LiteralMappingRegistryCreator
- WSDL::SOAP::MappingRegistryCreator
- WSDL::SOAP::MappingRegistryCreatorSupport
- WSDL::SOAP::MethodDefCreator
- WSDL::SOAP::Operation
- WSDL::SOAP::Operation::ParamInfo
- WSDL::SOAP::ServantSkeltonCreator
- WSDL::SOAP::ServletStubCreator
- WSDL::SOAP::StandaloneServerStubCreator
- WSDL::SOAP::WSDL2Ruby
- WSDL::Service
- WSDL::Types
- WSDL::XMLSchema
- WSDL::XMLSchema::All
- WSDL::XMLSchema::Annotation
- WSDL::XMLSchema::Any
- WSDL::XMLSchema::AnyAttribute
- WSDL::XMLSchema::Attribute
- WSDL::XMLSchema::AttributeGroup
- WSDL::XMLSchema::Choice
- WSDL::XMLSchema::ComplexContent
- WSDL::XMLSchema::ComplexExtension
- WSDL::XMLSchema::ComplexRestriction
- WSDL::XMLSchema::ComplexType
- WSDL::XMLSchema::Content
- WSDL::XMLSchema::Element
- WSDL::XMLSchema::Enumeration
- WSDL::XMLSchema::FractionDigits
- WSDL::XMLSchema::Group
- WSDL::XMLSchema::Import
- WSDL::XMLSchema::ImportHandler
- WSDL::XMLSchema::Importer
- WSDL::XMLSchema::Include
- WSDL::XMLSchema::Length
- WSDL::XMLSchema::List
- WSDL::XMLSchema::MaxExclusive
- WSDL::XMLSchema::MaxInclusive
- WSDL::XMLSchema::MaxLength
- WSDL::XMLSchema::MinExclusive
- WSDL::XMLSchema::MinInclusive
- WSDL::XMLSchema::MinLength
- WSDL::XMLSchema::Parser
- WSDL::XMLSchema::Parser::AttributeConstraintError
- WSDL::XMLSchema::Parser::ElementConstraintError
- WSDL::XMLSchema::Parser::FormatDecodeError
- WSDL::XMLSchema::Parser::ParseError
- WSDL::XMLSchema::Parser::ParseFrame
- WSDL::XMLSchema::Parser::UnexpectedElementError
- WSDL::XMLSchema::Parser::UnknownAttributeError
- WSDL::XMLSchema::Parser::UnknownElementError
- WSDL::XMLSchema::Pattern
- WSDL::XMLSchema::Ref
- WSDL::XMLSchema::Ref::RefClassSupport
- WSDL::XMLSchema::Schema
- WSDL::XMLSchema::Sequence
- WSDL::XMLSchema::SimpleContent
- WSDL::XMLSchema::SimpleExtension
- WSDL::XMLSchema::SimpleRestriction
- WSDL::XMLSchema::SimpleType
- WSDL::XMLSchema::TotalDigits
- WSDL::XMLSchema::Union
- WSDL::XMLSchema::Unique
- WSDL::XMLSchema::WhiteSpace
- WSDL::XMLSchema::XSD2Ruby
- XSD
- XSD::Charset
- XSD::Charset::CharsetConversionError
- XSD::Charset::CharsetError
- XSD::Charset::UnknownCharsetError
- XSD::Charset::XSDError
- XSD::CodeGen
- XSD::CodeGen::ClassDef
- XSD::CodeGen::CommentDef
- XSD::CodeGen::GenSupport
- XSD::CodeGen::MethodDef
- XSD::CodeGen::ModuleDef
- XSD::Error
- XSD::FloatConstants
- XSD::IconvCharset
- XSD::Mapping
- XSD::Mapping::Mapper
- XSD::NS
- XSD::NS::Assigner
- XSD::NS::FormatError
- XSD::NSDBase
- XSD::NamedElements
- XSD::QName
- XSD::ValueSpaceError
- XSD::XMLParser
- XSD::XMLParser::LibXMLParser
- XSD::XMLParser::Parser
- XSD::XMLParser::Parser::ElementConstraintError
- XSD::XMLParser::Parser::FormatDecodeError
- XSD::XMLParser::Parser::ParseError
- XSD::XMLParser::Parser::ParserError
- XSD::XMLParser::Parser::UnexpectedElementError
- XSD::XMLParser::Parser::UnknownAttributeError
- XSD::XMLParser::Parser::UnknownElementError
- XSD::XMLParser::REXMLParser
- XSD::XMLParser::XMLParser
- XSD::XMLParser::XMLParser::Listener
- XSD::XMLParser::XMLScanner
- XSD::XSDAnySimpleType
- XSD::XSDAnyURI
- XSD::XSDBase64Binary
- XSD::XSDBoolean
- XSD::XSDByte
- XSD::XSDDate
- XSD::XSDDateTime
- XSD::XSDDateTimeImpl
- XSD::XSDDecimal
- XSD::XSDDouble
- XSD::XSDDuration
- XSD::XSDENTITIES
- XSD::XSDENTITY
- XSD::XSDFloat
- XSD::XSDGDay
- XSD::XSDGMonth
- XSD::XSDGMonthDay
- XSD::XSDGYear
- XSD::XSDGYearMonth
- XSD::XSDHexBinary
- XSD::XSDID
- XSD::XSDIDREF
- XSD::XSDIDREFS
- XSD::XSDInt
- XSD::XSDInteger
- XSD::XSDLanguage
- XSD::XSDLong
- XSD::XSDNCName
- XSD::XSDNMTOKEN
- XSD::XSDNMTOKENS
- XSD::XSDName
- XSD::XSDNegativeInteger
- XSD::XSDNil
- XSD::XSDNonNegativeInteger
- XSD::XSDNonPositiveInteger
- XSD::XSDNormalizedString
- XSD::XSDPositiveInteger
- XSD::XSDQName
- XSD::XSDShort
- XSD::XSDString
- XSD::XSDTime
- XSD::XSDToken
- XSD::XSDUnsignedByte
- XSD::XSDUnsignedInt
- XSD::XSDUnsignedLong
- XSD::XSDUnsignedShort
- Object
- Object::SOAPMarshal
- WEBrick
- WEBrick::Log
- Enumerable
- Hash
- Kernel

No matching classes.

# WSDL::SOAP::MappingRegistryCreatorSupport

requires @defined_const = {}, @dump_with_inner, @modulepath

### Constants

DEFAULT_ITEM_NAME

### Public Instance Methods

create_array_element_definition(typedef, mpath) click to toggle source

used when "soapenc:arrayType" definition

    # File lib/wsdl/soap/mappingRegistryCreatorSupport.rb, line 324
    def create_array_element_definition(typedef, mpath)
      child_type = typedef.child_type
      child_element = typedef.find_aryelement
      if child_type == XSD::AnyTypeName
        type = nil
      elsif child_element
        if klass = element_basetype(child_element)
          type = klass.name
        else
          typename = child_element.type || child_element.name
          type = mapped_class_name(typename, mpath)
        end
      elsif child_type
        type = mapped_class_name(child_type, mpath)
      else
        type = nil
      end
      occurrence = [0, nil]
      if child_element and child_element.name
        if child_element.map_as_array?
          type << '[]' if type
          occurrence = [child_element.minoccurs, child_element.maxoccurs]
        end
        child_element_name = child_element.name
      else
        child_element_name = DEFAULT_ITEM_NAME
      end
      [child_element_name.name, child_element_name, type, occurrence]
    end

define_attribute(attributes) click to toggle source

    # File lib/wsdl/soap/mappingRegistryCreatorSupport.rb, line 200
    def define_attribute(attributes)
      schema_attribute = []
      attributes.each do |attribute|
        name = name_attribute(attribute)
        if klass = attribute_basetype(attribute)
          type = klass.name
        else
          warn("unresolved attribute type #{attribute.type} for #{name}")
          type = nil
        end
        schema_attribute << [name, type]
      end
      "{\n    " +
        schema_attribute.collect { |name, type|
          assign_const(name.namespace, 'Ns')
          dqname(name) + ' => ' + ndq(type)
        }.join(",\n    ") +
      "\n  }"
    end

define_dump_class(var, mpath, qname, typedef, as_element, opt) click to toggle source

    # File lib/wsdl/soap/mappingRegistryCreatorSupport.rb, line 354
    def define_dump_class(var, mpath, qname, typedef, as_element, opt)
      var[:class] = mapped_class_name(qname, mpath)
      if as_element
        var[:schema_name] = as_element
        schema_ns = as_element.namespace
      elsif typedef.name.nil?
        var[:schema_name] = qname
        schema_ns = qname.namespace
      else
        var[:schema_type] = qname
        schema_ns = qname.namespace
      end
      var[:is_anonymous] = opt[:is_anonymous] if opt.key?(:is_anonymous)
      # true, false, or nil
      if opt.key?(:qualified)
        var[:schema_qualified] = opt[:qualified].to_s
      end
    end

dump_array_typemap(mpath, qname, typedef, as_element, opt) click to toggle source

    # File lib/wsdl/soap/mappingRegistryCreatorSupport.rb, line 44
    def dump_array_typemap(mpath, qname, typedef, as_element, opt)
      if typedef.find_soapenc_arytype
        if opt[:encoded]
          dump_encoded_array_typemap(mpath, qname, typedef, as_element, opt)
        end
      else
        dump_literal_array_typemap(mpath, qname, typedef, as_element, opt)
      end
    end

dump_complex_typemap(mpath, qname, typedef, as_element, opt) click to toggle source

    # File lib/wsdl/soap/mappingRegistryCreatorSupport.rb, line 54
    def dump_complex_typemap(mpath, qname, typedef, as_element, opt)
      var = {}
      define_dump_class(var, mpath, qname, typedef, as_element, opt)
      schema_ns = (var[:schema_name] || var[:schema_type]).namespace
      if var[:schema_type] and typedef.base
        var[:schema_basetype] = typedef.base
      end
      parentmodule = var[:class]
      parsed_element =
        parse_elements(typedef.elements, qname.namespace, parentmodule, opt)
      if typedef.choice?
        parsed_element.unshift(:choice)
      end
      var[:schema_element] = dump_schema_element_definition(parsed_element, 2)
      unless typedef.attributes.empty?
        var[:schema_attribute] = define_attribute(typedef.attributes)
      end
      assign_const(schema_ns, 'Ns')
      dump_entry(@varname, var)
    end

dump_complextypedef(mpath, qname, typedef, as_element = nil, opt = {}) click to toggle source

    # File lib/wsdl/soap/mappingRegistryCreatorSupport.rb, line 27
    def dump_complextypedef(mpath, qname, typedef, as_element = nil, opt = {})
      case typedef.compoundtype
      when :TYPE_STRUCT, :TYPE_EMPTY
        dump_complex_typemap(mpath, qname, typedef, as_element, opt)
      when :TYPE_ARRAY
        dump_array_typemap(mpath, qname, typedef, as_element, opt)
      when :TYPE_SIMPLE
        dump_simple_typemap(mpath, qname, typedef, as_element, opt)
      when :TYPE_MAP
        # mapped as a general Hash
        nil
      else
        raise RuntimeError.new(
          "unknown kind of complexContent: #{typedef.compoundtype}")
      end
    end

dump_encoded_array_typemap(mpath, qname, typedef, as_element, opt) click to toggle source

    # File lib/wsdl/soap/mappingRegistryCreatorSupport.rb, line 310
    def dump_encoded_array_typemap(mpath, qname, typedef, as_element, opt)
      arytype = typedef.find_arytype || XSD::AnyTypeName
      type = XSD::QName.new(arytype.namespace, arytype.name.sub(/\[(?:,)*\]$/, ''))
      return #{@varname}.set(  #{mapped_class_name(qname, mpath)},  ::SOAP::SOAPArray,  ::SOAP::Mapping::EncodedRegistry::TypedArrayFactory,  { :type => #{dqname(type)} })
    end

dump_entry(regname, var) click to toggle source

    # File lib/wsdl/soap/mappingRegistryCreatorSupport.rb, line 220
    def dump_entry(regname, var)
      "#{regname}.register(\n  " +
        [
          dump_entry_item(var, :class),
          dump_entry_item(var, :soap_class),
          dump_entry_item(var, :schema_name, :qname),
          dump_entry_item(var, :schema_type, :qname),
          dump_entry_item(var, :is_anonymous),
          dump_entry_item(var, :schema_basetype, :qname),
          dump_entry_item(var, :schema_qualified),
          dump_entry_item(var, :schema_element),
          dump_entry_item(var, :schema_attribute)
        ].compact.join(",\n  ") +
      "\n)\n"
    end

dump_entry_item(var, key, dump_type = :none) click to toggle source

    # File lib/wsdl/soap/mappingRegistryCreatorSupport.rb, line 236
    def dump_entry_item(var, key, dump_type = :none)
      if var.key?(key)
        case dump_type
        when :none
          ":#{key} => #{var[key]}"
        when :string
          if @defined_const.key?(var[key])
            ":#{key} => #{@defined_const[var[key]]}"
          else
            ":#{key} => #{ndq(var[key])}"
          end
        when :qname
          qname = var[key]
          if @defined_const.key?(qname.namespace)
            ns = @defined_const[qname.namespace]
          else
            ns = ndq(qname.namespace)
          end
          ":#{key} => XSD::QName.new(#{ns}, #{ndq(qname.name)})"
        else
          raise "Unknown dump type: #{dump_type}"
        end
      end
    end

dump_literal_array_typemap(mpath, qname, typedef, as_element, opt) click to toggle source

    # File lib/wsdl/soap/mappingRegistryCreatorSupport.rb, line 296
    def dump_literal_array_typemap(mpath, qname, typedef, as_element, opt)
      var = {}
      define_dump_class(var, mpath, qname, typedef, as_element, opt)
      schema_ns = (var[:schema_name] || var[:schema_type]).namespace
      parsed_element =
        parse_elements(typedef.elements, qname.namespace, var[:class], opt)
      if parsed_element.empty?
        parsed_element = [create_array_element_definition(typedef, mpath)]
      end
      var[:schema_element] = dump_schema_element_definition(parsed_element, 2)
      assign_const(schema_ns, 'Ns')
      dump_entry(@varname, var)
    end

dump_occurrence(occurrence) click to toggle source

    # File lib/wsdl/soap/mappingRegistryCreatorSupport.rb, line 123
    def dump_occurrence(occurrence)
      if occurrence and occurrence != [1, 1] # default
        minoccurs, maxoccurs = occurrence
        maxoccurs ||= 'nil'
        "[#{minoccurs}, #{maxoccurs}]"
      end
    end

dump_schema_element(schema_element, indent = 0) click to toggle source

    # File lib/wsdl/soap/mappingRegistryCreatorSupport.rb, line 106
    def dump_schema_element(schema_element, indent = 0)
      sp = ' ' * indent
      delimiter = ",\n" + sp
      sp + schema_element.collect { |definition|
        dump_schema_element_definition(definition, indent)
      }.join(delimiter)
    end

dump_schema_element_definition(definition, indent = 0) click to toggle source

    # File lib/wsdl/soap/mappingRegistryCreatorSupport.rb, line 86
    def dump_schema_element_definition(definition, indent = 0)
      return '[]' if definition.empty?
      sp = ' ' * indent
      if definition[0] == :choice
        definition.shift
        "[ :choice,\n" +
          dump_schema_element(definition, indent + 2) + "\n" + sp + "]"
      elsif definition[0].is_a?(::Array)
        "[\n" +
          dump_schema_element(definition, indent + 2) + "\n" + sp + "]"
      else
        varname, name, type, occurrence = definition
        '[' + [
          varname.dump,
          dump_type(name, type),
          dump_occurrence(occurrence)
        ].compact.join(', ') + ']'
      end
    end

dump_simple_typemap(mpath, qname, typedef, as_element, opt) click to toggle source

    # File lib/wsdl/soap/mappingRegistryCreatorSupport.rb, line 75
    def dump_simple_typemap(mpath, qname, typedef, as_element, opt)
      var = {}
      define_dump_class(var, mpath, qname, typedef, as_element, opt)
      schema_ns = (var[:schema_name] || var[:schema_type]).namespace
      unless typedef.attributes.empty?
        var[:schema_attribute] = define_attribute(typedef.attributes)
      end
      assign_const(schema_ns, 'Ns')
      dump_entry(@varname, var)
    end

dump_simpletypedef(mpath, qname, simpletype, as_element = nil, opt = {}) click to toggle source

    # File lib/wsdl/soap/mappingRegistryCreatorSupport.rb, line 261
    def dump_simpletypedef(mpath, qname, simpletype, as_element = nil, opt = {})
      if simpletype.restriction
        dump_simpletypedef_restriction(mpath, qname, simpletype, as_element, opt)
      elsif simpletype.list
        dump_simpletypedef_list(mpath, qname, simpletype, as_element, opt)
      elsif simpletype.union
        dump_simpletypedef_union(mpath, qname, simpletype, as_element, opt)
      else
        raise RuntimeError.new("unknown kind of simpletype: #{simpletype}")
      end
    end

dump_simpletypedef_list(mpath, qname, typedef, as_element, opt) click to toggle source

    # File lib/wsdl/soap/mappingRegistryCreatorSupport.rb, line 286
    def dump_simpletypedef_list(mpath, qname, typedef, as_element, opt)
      nil
    end

dump_simpletypedef_restriction(mpath, qname, typedef, as_element, opt) click to toggle source

    # File lib/wsdl/soap/mappingRegistryCreatorSupport.rb, line 273
    def dump_simpletypedef_restriction(mpath, qname, typedef, as_element, opt)
      restriction = typedef.restriction
      unless restriction.enumeration?
        # not supported.  minlength?
        return nil
      end
      var = {}
      define_dump_class(var, mpath, qname, typedef, as_element, opt)
      schema_ns = (var[:schema_name] || var[:schema_type]).namespace
      assign_const(schema_ns, 'Ns')
      dump_entry(@varname, var)
    end

dump_simpletypedef_union(mpath, qname, typedef, as_element, opt) click to toggle source

    # File lib/wsdl/soap/mappingRegistryCreatorSupport.rb, line 290
    def dump_simpletypedef_union(mpath, qname, typedef, as_element, opt)
      nil
    end

dump_type(name, type) click to toggle source

    # File lib/wsdl/soap/mappingRegistryCreatorSupport.rb, line 114
    def dump_type(name, type)
      if name
        assign_const(name.namespace, 'Ns')
        '[' + ndq(type) + ', ' + dqname(name) + ']'
      else
        ndq(type)
      end
    end

dump_with_inner() click to toggle source

    # File lib/wsdl/soap/mappingRegistryCreatorSupport.rb, line 21
    def dump_with_inner
      @dump_with_inner = []
      @dump_with_inner.unshift(yield)
      @dump_with_inner.join("\n")
    end

parse_elements(elements, base_namespace, mpath, opt) click to toggle source

    # File lib/wsdl/soap/mappingRegistryCreatorSupport.rb, line 131
    def parse_elements(elements, base_namespace, mpath, opt)
      schema_element = []
      any = false
      elements.each do |element|
        case element
        when XMLSchema::Any
          # only 1 <any/> is allowed for now.
          raise RuntimeError.new("duplicated 'any'") if any
          any = true
          varname = 'any' # not used
          eleqname = XSD::AnyTypeName
          type = nil
          occurrence = nil
          schema_element << [varname, eleqname, type, occurrence]
        when XMLSchema::Element
          next if element.ref == SchemaName
          typebase = @modulepath
          if element.anonymous_type?
            child_opt = {
              :qualified => (element.elementform == 'qualified'),
              :is_anonymous => true
            }
            @dump_with_inner << dump_complextypedef(mpath, element.name, element.local_complextype, nil, child_opt)
            typebase = mpath
          end
          type = create_type_name(typebase, element)
          name = name_element(element).name
          varname = safevarname(name)
          if element.map_as_array?
            if type
              type += '[]'
            else
              type = '[]'
            end
          end
          # nil means @@schema_ns + varname
          eleqname = element.name || element.ref
          if eleqname && varname == name && eleqname.namespace == base_namespace
            eleqname = nil
          end
          occurrence = [element.minoccurs, element.maxoccurs]
          schema_element << [varname, eleqname, type, occurrence]
        when WSDL::XMLSchema::Sequence
          child_schema_element =
            parse_elements(element.elements, base_namespace, mpath, opt)
          schema_element << child_schema_element
        when WSDL::XMLSchema::Choice
          child_schema_element =
            parse_elements(element.elements, base_namespace, mpath, opt)
          if !element.map_as_array?
            # choice + maxOccurs="unbounded" is treated just as 'all' now.
            child_schema_element.unshift(:choice)
          end
          schema_element << child_schema_element
        when WSDL::XMLSchema::Group
          if element.content.nil?
            warn("no group definition found: #{element}")
            next
          end
          child_schema_element =
            parse_elements(element.content.elements, base_namespace, mpath, opt)
          schema_element.concat(child_schema_element)
        else
          raise RuntimeError.new("unknown type: #{element}")
        end
      end
      schema_element
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.