Gets DOM element value.

@param  Object element A DOM element
@return mixed          The DOM element value
485549
function getValue(element) {
  var name = elementType(element);
  switch (name) {
    case "checkbox":
    case "radio":
      if (!element.checked) {
        return false;
      }
      var val = element.getAttribute('value');
      return val == null ? true : val;
    case "select":
    case "select-multiple":
      var options = element.options;
      var values = [];
      for (var i = 0, len = options.length; i < len; i++) {
        if (options[i].selected) {
          values.push(options[i].value);
        }
      }
      return name === "select-multiple" ? values : values[0];
    default:
      return element.value;
  }
}
534035
protected function element($element = null)
    {
        return is_null($element)
            ? $this->element
            : ($this->element = $element);
    }
510930
protected function canonicalize(\DOMNode $object)
	{		
		$options = $this->c14nOptionMapping[$this->canonicalMethod];
		
		// canonicalize the provided data with the preset options
		$c14nData = $object->C14N($options['exclusive'], $options['withComments']);
		
		if (is_string($c14nData) && strlen($c14nData))
		{
			return $c14nData;
		}
		
		throw new \UnexpectedValueException('Unable to canonicalize the provided DOM document');
	}
1145630
public function retriveAttributeType(\DOMElement $element)
    {
        $name = $this->engine->query($element->getNodePath() . '/dia:attribute[@name="type"]/dia:string');
        return $this->cleanString($name->item(0)->nodeValue);
    }
537959
public function getValue()
    {
        $value = [];
        foreach ($this->getElements() as $el) {
            if ($el->getKey() !== null) {
                $value[$el->getKey()] = $el->getValue();
            } else {
                $value[] = $el->getValue();
            }
        }

        return $value;
    }
1355349
public function getAttrByElem($element) {
        $nodes = $this->_dom_x_path->query("//{$element}");
        
        $contents = [];
        $attrs = [];
        
        foreach ($nodes as $node) {
            
            $attrs = [];
            
            foreach ($node->attributes as $attr) {
                $attrs["{$attr->nodeName}"] = $attr->nodeValue;
            }
            
            array_push($contents, $attrs);
            
        }
        
        return $contents;
    }
811318
private String getElementValue(Element parent, String elementName) {
        String value = null;
        NodeList nodes = parent.getElementsByTagName(elementName);
        if (nodes.getLength() > 0) {
            value = nodes.item(0).getChildNodes().item(0).getNodeValue();
        }
        return value;
    }
275129
private function getFieldValue($element) : bool
    {
        if (!($name = $element->getName())) {
            return false;
        }

        if (substr($name, -2) == '[]' && !$element instanceof MultipleValueInterface) {
            $currentName = substr($name, 0, -2);
            if (!isset($this->arrayNameIndex[$currentName])) {
                $this->arrayNameIndex[$currentName] = 0;
            } else {
                $this->arrayNameIndex[$currentName]++;
            }

            $name = $currentName . '[' . $this->arrayNameIndex[$currentName] . ']';
        }

        if ($element instanceof File) {
            $userInput = self::request()->getUploadedFile($name);
        } else {
            $userInput = self::request()->getArg($name);
        }

        $userInput = $userInput != '' ? $userInput : null;

        list($valid, $value, $typedValue) = $this->validateValue($element, $userInput);

        // We set values with type cast value if valid, else type cast, else user input
        $elementValue = $value ?? (isset($typedValue) ? $typedValue : $userInput);

        if (is_array($elementValue) && !$element instanceof MultipleValueInterface) {
            $elementValue = null;
        }

        $element->setValue($elementValue);
        $this->storeValue($name, $valid, $userInput, $elementValue);

        return true;
    }
1187639
public function getElements($className = ''){

        $returnValue = array();

        if($className){
            foreach($this->elements as $serial => $element){
                if($element instanceof $className){
                    $returnValue[$serial] = $element;
                }
            }
        }else{
            $returnValue = $this->elements;
        }


        return $returnValue;
    }
1096710
protected function processObject(FormElementInterface $element, $object)
    {
        $properties = $element->getProperties();
        if ($object instanceof \DateTime) {
            if (isset($properties['dateFormat'])) {
                $dateFormat = $properties['dateFormat'];
                if (isset($properties['displayTimeSelector']) && $properties['displayTimeSelector'] === true) {
                    $dateFormat .= ' H:i';
                }
            } else {
                $dateFormat = \DateTime::W3C;
            }
            return $object->format($dateFormat);
        }
        if ($object instanceof Image) {
            return sprintf('%s Image (%d x %d)', $object->getFileExtension(), $object->getWidth(), $object->getHeight());
        }
        if (method_exists($object, '__toString')) {
            return (string)$object;
        }
        return 'Object [' . get_class($object) . ']';
    }
857944
public function getValue()
    {
        $value = '';

        if (is_array($this->_value)) {
            foreach ($this->_value as $v) {
                if ($v instanceof XMLElement) {
                    $value .= $v->generate();
                } else {
                    $value .= $v;
                }
            }
        } elseif (!is_null($this->_value)) {
            $value = $this->_value;
        }

        return $value;
    }
1372793
private function getValueFromKey($element, $key)
    {
        if ((is_object($element) && !$this->getValueKeyFromObject($element, $key)) || (is_array($element) && !isset($element[$key]))) {
            $getterName = 'get'.str_replace(' ', '', ucwords($key));

            throw new NotValidKeyElementInListException($key.' is not a valid key. If your elements are Entities class, please check if you implement '.$getterName.'() method.');
        }

        return is_object($element) ? $this->getValueKeyFromObject($element, $key) : $element[$key];
    }
1089757
public function getElement($serial){

        $returnValue = null;

        if(isset($this->elements[$serial])){
            $returnValue = $this->elements[$serial];
        }

        return $returnValue;
    }
983158
protected function getObjectParams(DOMElement $object)
	{
		$params      = [];
		$settingName = strtolower($this->settingName);
		foreach ($object->getElementsByTagName('param') as $param)
		{
			$paramName = strtolower($param->getAttribute('name'));
			if ($paramName === $settingName && $param->parentNode->isSameNode($object))
			{
				$params[] = $param;
			}
		}

		return $params;
	}
307784
private function getPropertyValue($object, Property $field)
    {
        return $this->accessor->getValue($object, $field->getProperty());
    }
1099198
public function getElement($name)
    {
        $returnValue = null;



		foreach($this->elements as $element){
			if($element->getName() == $name){
				$returnValue = $element;
				break;
			}
		}
		if (is_null($returnValue)) {
			common_Logger::w('Element with name \''.$name.'\' not found');
		}


        return $returnValue;
    }
543028
public function _getValue($xpath)
    {
        $xpathEscaped = json_encode($xpath);
        $script = <<<JS
var node = this.browserbot.locateElementByXPath({$xpathEscaped}, window.document),
tagName = node.tagName.toLowerCase(),
value = null;
if (tagName == 'input' || tagName == 'textarea') {
var type = node.getAttribute('type');
if (type == 'checkbox') {
value = node.checked;
} else if (type == 'radio') {
var name = node.getAttribute('name');
if (name) {
var fields = window.document.getElementsByName(name),
i, l = fields.length;
for (i = 0; i < l; i++) {
var field = fields.item(i);
if (field.checked) {
value = field.value;
break;
}
}
}
} else {
value = node.value;
}
} else if (tagName == 'select') {
if (node.getAttribute('multiple')) {
value = [];
for (var i = 0; i < node.options.length; i++) {
if (node.options[i].selected) {
value.push(node.options[i].value);
}
}
} else {
var idx = node.selectedIndex;
if (idx >= 0) {
value = node.options.item(idx).value;
} else {
value = null;
}
}
} else {
value = node.getAttribute('value');
}
JSON.stringify(value)
JS;
        $sResult = json_decode($this->getMinkSession()->getDriver()->getBrowser()->getEval($script));

        return preg_replace("/[ \n]+/", " ", $sResult);
    }