private static function buildResponseCondition( SimpleXMLElement $data)
    {
        $responseCondition = new ResponseCondition();
		
		foreach ($data->children() as $child) {
			switch ($child->getName()) {
				case 'responseIf' :
				case 'responseElseIf' :
					$subchildren = null;
					foreach ($child->children() as $subchild){
						$subchildren[] = $subchild;
					}
		
					// first node is condition
					$conditionNode = array_shift($subchildren);
					$condition = ExpressionParserFactory::build($conditionNode);
					
					// all the other nodes are action
					$responseRules = array();
					foreach ($subchildren as $responseRule){
						$responseRules[] = self::buildResponseRule($responseRule);
					}
					$responseCondition->addResponseIf($condition, $responseRules);
							
					break;
					
				case 'responseElse' :
					$responseRules = array();
					foreach ($child->children() as $responseRule) {
						$responseRules[] = self::buildResponseRule($responseRule);
					}
					$responseCondition->setResponseElse($responseRules);
					break;
					
				default:
					throw new ParsingException('unknown node in ResponseCondition');
			}
		}

		$returnValue = $responseCondition; 

        return $returnValue;
    }