Method: XSD::Element#substitutable_elements

Defined in:
lib/xsd/objects/element.rb

#substitutable_elementsObject

Get substitutable elements



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/xsd/objects/element.rb', line 135

def substitutable_elements
  @substitutable_elements ||= begin
                                if ref
                                  reference.substitutable_elements
                                elsif !global? || %w[#all substitution].include?(block)
                                  []
                                else
                                  # TODO: we search substituted element only in the same schema with head element, is this enough?
                                  # TODO: maybe don't collect all elements but search with xpath first?
                                  schema.collect_elements.select do |element|
                                    strip_prefix(element.substitution_group) == name
                                  end
                                end
                              end
end