def process_field(child)
      if ['complexContent', 'simpleContent', 'sequence', 'group', 'choice', 'extension', 'restriction'].include?(child.name)
        child.elements.each {|grandchild| process_field(grandchild)}
      elsif child.name == 'element'
        element = Element.new(child, self.schema, self)
        @elements[element.name] = element
      elsif child.name == 'attribute'
        attribute = Attribute.new(child, self.schema, self)
        @attributes[attribute.name] = attribute
      elsif child.name == 'complexType'
        type = ComplexType.build(child, self.schema)
        @types[type.name] = type
      elsif child.name == 'simpleType'
        type = SimpleType.build(child, self.schema)
        @types[type.name] = type
      elsif child.name == 'anyAttribute'
        @special_fields << SpecialField.new("##anyAttribute")
      elsif child.name == 'anyElement'
        @special_fields << SpecialField.new("##anyElement")
      elsif child.name == 'attributeGroup'
        # The only special case here...essentially we'll' transparently roll attribute groups into parent nodes,
        # while at the schema level global attribute groups get created as a type
        if self.kind_of?(Schema)
          type = ComplexType.build(child, self.schema)
          @types[type.name] = type
        else
          Type.find(child.attributes['ref'].value, nil, stix_version).attributes.each {|attrib| @attributes[attrib.name] = attrib}
        end
      else
        $logger.debug "Skipping: #{child.name}" if defined?($logger)
      end
    end
def process_field(child)
      if ['complexContent', 'simpleContent', 'sequence', 'group', 'choice', 'extension', 'restriction'].include?(child.name)
        child.elements.each {|grandchild| process_field(grandchild)}
      elsif child.name == 'element'
        element = Element.new(child, self.schema, self)
        @elements[element.name] = element
      elsif child.name == 'attribute'
        attribute = Attribute.new(child, self.schema, self)
        @attributes[attribute.name] = attribute
      elsif child.name == 'complexType'
        type = ComplexType.build(child, self.schema)
        @types[type.name] = type
      elsif child.name == 'simpleType'
        type = SimpleType.build(child, self.schema)
        @types[type.name] = type
      elsif child.name == 'anyAttribute'
        @special_fields << SpecialField.new("##anyAttribute")
      elsif child.name == 'anyElement'
        @special_fields << SpecialField.new("##anyElement")
      elsif child.name == 'attributeGroup'
        # The only special case here...essentially we'll' transparently roll attribute groups into parent nodes,
        # while at the schema level global attribute groups get created as a type
        if self.kind_of?(Schema)
          type = ComplexType.build(child, self.schema)
          @types[type.name] = type
        else
          Type.find(child.attributes['ref'].value, nil, stix_version).attributes.each {|attrib| @attributes[attrib.name] = attrib}
        end
      else
        $logger.debug "Skipping: #{child.name}" if defined?($logger)
      end
    end
def process_field ( child ) if [ 'complexContent' , 'simpleContent' , 'sequence' , 'group' , 'choice' , 'extension' , 'restriction' ] . include? ( child . name ) child . elements . each { | grandchild | process_field ( grandchild ) } elsif child . name == 'element' element = Element . new ( child , self . schema , self ) @elements [ element . name ] = element elsif child . name == 'attribute' attribute = Attribute . new ( child , self . schema , self ) @attributes [ attribute . name ] = attribute elsif child . name == 'complexType' type = ComplexType . build ( child , self . schema ) @types [ type . name ] = type elsif child . name == 'simpleType' type = SimpleType . build ( child , self . schema ) @types [ type . name ] = type elsif child . name == 'anyAttribute' @special_fields << SpecialField . new ( "##anyAttribute" ) elsif child . name == 'anyElement' @special_fields << SpecialField . new ( "##anyElement" ) elsif child . name == 'attributeGroup' # The only special case here...essentially we'll' transparently roll attribute groups into parent nodes, # while at the schema level global attribute groups get created as a type if self . kind_of? ( Schema ) type = ComplexType . build ( child , self . schema ) @types [ type . name ] = type else Type . find ( child . attributes [ 'ref' ] . value , nil , stix_version ) . attributes . each { | attrib | @attributes [ attrib . name ] = attrib } end else $logger . debug "Skipping: #{child.name}" if defined? ( $logger ) end end
Runs through the list of fields under this type and creates the appropriate objects
Runs through the list of fields under this type and creates the appropriate objects