Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

Changeset 1906

Show
Ignore:
Timestamp:
07/23/07 23:53:17 (10 months ago)
Author:
nahi
Message:
  • added <xsd:group> support. closes #391.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/wsdl/definitions.rb

    r1824 r1906  
    6060    @imports.each do |import| 
    6161      result.concat(import.content.collect_attributes) 
     62    end 
     63    result 
     64  end 
     65 
     66  def collect_modelgroups 
     67    result = XSD::NamedElements.new 
     68    if @types 
     69      @types.schemas.each do |schema| 
     70        result.concat(schema.collect_modelgroups) 
     71      end 
     72    end 
     73    @imports.each do |import| 
     74      result.concat(import.content.collect_modelgroups) 
    6275    end 
    6376    result 
  • trunk/lib/wsdl/soap/classDefCreator.rb

    r1899 r1906  
    3232    @complextypes = definitions.collect_complextypes 
    3333    @complextypes.uniq! 
     34    @modelgroups = definitions.collect_modelgroups 
     35    @modelgroups.uniq! 
    3436    @faulttypes = nil 
    3537    if definitions.respond_to?(:collect_faulttypes) 
     
    4951      result << dump_classdef(type.name, type) 
    5052    else 
     53      str = dump_group 
     54      unless str.empty? 
     55        result << "\n" unless result.empty? 
     56        result << str 
     57      end 
    5158      str = dump_complextype 
    5259      unless str.empty? 
     
    112119    definitions = sort_dependency(@complextypes).collect { |type| 
    113120      dump_complextypedef(type.name, type) 
     121    }.compact.join("\n") 
     122  end 
     123 
     124  def dump_group 
     125    definitions = @modelgroups.collect { |group| 
     126      # ??? 
    114127    }.compact.join("\n") 
    115128  end 
     
    298311        init_lines.concat(child_init_lines) 
    299312        init_params.concat(child_init_params) 
     313      when WSDL::XMLSchema::Group 
     314        if element.content.nil? 
     315          warn("no group definition found: #{element}") 
     316          next 
     317        end 
     318        child_init_lines, child_init_params = 
     319          parse_elements(c, element.content.elements, base_namespace) 
     320        init_lines.concat(child_init_lines) 
     321        init_params.concat(child_init_params) 
    300322      else 
    301323        raise RuntimeError.new("unknown type: #{element}") 
  • trunk/lib/wsdl/soap/mappingRegistryCreatorSupport.rb

    r1895 r1906  
    104104        child_schema_element.unshift(:choice) 
    105105        schema_element << child_schema_element 
     106      when WSDL::XMLSchema::Group 
     107        if element.content.nil? 
     108          warn("no group definition found: #{element}") 
     109          next 
     110        end 
     111        child_schema_element = parse_elements(element.content.elements, base_namespace) 
     112        schema_element.concat(child_schema_element) 
    106113      else 
    107114        raise RuntimeError.new("unknown type: #{element}") 
  • trunk/lib/wsdl/xmlSchema/choice.rb

    r1824 r1906  
    4040      @elements << o 
    4141      o 
     42    when GroupName 
     43      o = Group.new 
     44      @elements << o 
     45      o 
    4246    when AnyName 
    4347      raise ElementConstraintError.new("duplicated element: any") if @any 
  • trunk/lib/wsdl/xmlSchema/complexType.rb

    r1905 r1906  
    129129    when ChoiceName 
    130130      @content = Choice.new 
     131    when GroupName 
     132      @content = Group.new 
    131133    when ComplexContentName 
    132134      @complexcontent = ComplexContent.new 
  • trunk/lib/wsdl/xmlSchema/data.rb

    r1905 r1906  
    3030require 'wsdl/xmlSchema/union' 
    3131require 'wsdl/xmlSchema/unique' 
     32require 'wsdl/xmlSchema/group' 
    3233 
    3334require 'wsdl/xmlSchema/length' 
     
    5859ElementName = XSD::QName.new(XSD::Namespace, 'element') 
    5960ExtensionName = XSD::QName.new(XSD::Namespace, 'extension') 
     61GroupName = XSD::QName.new(XSD::Namespace, 'group') 
    6062ImportName = XSD::QName.new(XSD::Namespace, 'import') 
    6163IncludeName = XSD::QName.new(XSD::Namespace, 'include') 
  • trunk/lib/wsdl/xmlSchema/element.rb

    r1905 r1906  
    1 # WSDL4R - XMLSchema element definition for WSDL
     1# WSDL4R - XMLSchema element definition
    22# Copyright (C) 2000-2007  NAKAMURA, Hiroshi <nahi@ruby-lang.org>. 
    33 
  • trunk/lib/wsdl/xmlSchema/schema.rb

    r1905 r1906  
    2121  attr_reader :elements 
    2222  attr_reader :attributes 
     23  attr_reader :modelgroups 
    2324  attr_reader :imports 
    2425  attr_accessor :attributeformdefault 
     
    3536    @elements = XSD::NamedElements.new 
    3637    @attributes = XSD::NamedElements.new 
     38    @modelgroups = XSD::NamedElements.new 
    3739    @imports = [] 
    3840    @attributeformdefault = "unqualified" 
     
    7981      @attributes << o 
    8082      o 
     83    when GroupName 
     84      o = Group.new 
     85      @modelgroups << o 
     86      o 
    8187    else 
    8288      nil 
     
    104110    @imports.each do |import| 
    105111      result.concat(import.content.collect_attributes) if import.content 
     112    end 
     113    result 
     114  end 
     115 
     116  def collect_modelgroups 
     117    result = XSD::NamedElements.new 
     118    result.concat(@modelgroups) 
     119    @imports.each do |import| 
     120      result.concat(import.content.collect_modelgroups) if import.content 
    106121    end 
    107122    result 
  • trunk/lib/wsdl/xmlSchema/sequence.rb

    r1824 r1906  
    3636      @elements << o 
    3737      o 
     38    when GroupName 
     39      o = Group.new 
     40      @elements << o 
     41      o 
    3842    when AnyName 
    3943      raise ElementConstraintError.new("duplicated element: any") if @any