Gets the XML Language List from a XML branch.
@param SimpleXMLElement $element The XML Element where the list is placed.
547909
private function getXMLLanguageList(SimpleXMLElement $element)
    {
        $this->xml_language_list = new CNabuXMLLanguageList(new CNabuLanguageList());
        $this->xml_language_list->collect($element);
    }
354579
protected function simpleXmlToArray(SimpleXMLElement $xml) {
		$result = [];
		
		foreach ($xml as $element) {
			$name    = $element->getName();
			$content = get_object_vars($element);
			
			if (isset($content['@attributes'])){
				if (isset($content['@attributes']['value'])) {
					$result[$name] = Std::parseValue($content['@attributes']['value']);
					continue;
				}
				
				unset($content['@attributes']);
			}
			
			if (empty($content)) {
				$result[$name] = Std::parseValue($element);
				continue;
			}
			
			$result[$name] = $this->simpleXmlToArray($element);
		}
		
		return $result;
	}
1025162
protected function setAttributes(SimpleXMLElement $element)
    {
        $nb_parent = $this->nb_data_object->getTranslatedObject();
        if ($nb_parent !== null) {
            $nb_language = $nb_parent->getLanguage($this->nb_data_object->getLanguageId());
            $element->addAttribute('lang', $nb_language->grantHash(true));
            $this->putAttributesFromList($element, array(
                'nb_site_target_section_main_image' => 'image'
            ), false);
        }
    }
1358256
private static function deserializeLicenseTemplates($xmlElement)
    {
        $result = [];

        foreach ($xmlElement->children() as $child) {
            $result[] = self::deserializePlayReadyLicenseTemplate($child);
        }

        return $result;
    }
667631
public function parseXML(\SimpleXMLElement $xml)
    {
        $name = $xml->getName();
        if ($name !== 'svg') {
            return null;
        }

        $width = isset($xml['width']) ? $xml['width'] : null;
        $height = isset($xml['height']) ? $xml['height'] : null;
        $namespaces = $xml->getNamespaces(true);

        $img = new SVG($width, $height, $namespaces);

        $nsKeys = array_keys($namespaces);

        $doc = $img->getDocument();
        $this->applyAttributes($doc, $xml, $nsKeys);
        $this->applyStyles($doc, $xml);
        $this->addChildren($doc, $xml, $nsKeys);

        return $img;
    }
407853
public function toArray(SimpleXMLElement $xml = null)
	{
		if ($xml === null) {
			$xml = $this->xml;
		}

		if (!$xml->children()) {
			return (string) $xml;
		}

		$arr = array();
		foreach ($xml->children() as $tag => $child) {
			if (count($xml->$tag) === 1) {
				$arr[$tag] = $this->toArray($child);
			} else {
				$arr[$tag][] = $this->toArray($child);
			}
		}

		return $arr;
	}
1267875
protected function moveChildNamespacesToEnvelope(\SimpleXMLElement $element): \SimpleXMLElement
    {
        $dom = dom_import_simplexml($element);

        foreach ($element->getNamespaces(true) as $prefix => $namespace) {
            if (!in_array($namespace, $element->getDocNamespaces())) {
                $dom->setAttributeNS(
                    'http://www.w3.org/2000/xmlns/',
                    $prefix ? 'xmlns:' . $prefix : 'xmlns',
                    $namespace
                );
            }
        }

        return simplexml_import_dom($dom->ownerDocument);
    }
1251503
private function parseDiffXml( SimpleXMLElement $xml )
    {
        $newTables = array();
        foreach ( $xml->{'new-tables'}->table as $table )
        {
            $tableName = (string) $table->name;
            $newTables[$tableName] = $this->parseTable( $table );
        }

        $changedTables = array();
        foreach ( $xml->{'changed-tables'}->table as $table )
        {
            $tableName = (string) $table->name;
            $changedTables[$tableName] = $this->parseChangedTable( $table );
        }

        $removedTables = array();
        foreach ( $xml->{'removed-tables'}->table as $table )
        {
            $tableName = (string) $table->name;
            if ( (string) $table->removed == 'true' )
            {
                $removedTables[$tableName] = true;
            }
        }

        return new ezcDbSchemaDiff( $newTables, $changedTables, $removedTables );
    }
89626
private static function xml2array(\SimpleXMLElement $xml)
    {
        $arr = [];

        if ($xml) {
            foreach ($xml->children() as $r) {
                $t = [];
                if (!is_null($r) && count($r->children()) == 0) {
                    $arr[$r->getName()] = strval($r);
                } else {
                    $arr[$r->getName()][] = self::xml2array($r);
                }
            }
        }

        return $arr;
    }
886118
public function getEntityForElement( $element )
	{
		if ( isset( $element['contextRef'] ) )
		{
			return $this->contexts[ $element['contextRef'] ]['entity']['identifier']['value'];
		}

		if ( isset( $element['tuple_elements'] ) )
		{
			foreach ( $element['tuple_elements'] as $elementKey => $tuple_elements )
			{
				foreach ( $tuple_elements as $tupleIndex => $tuple_element )
				{
					$result = $this->getEntityForElement( $tuple_element );
					if ( $result ) return $result;
				}
			}
		}

		throw new Exception( "The element '{$element['taxonomy_element']['id']}' has no context ref but also has no tuple members (getEntityForElement)" );
	}
299100
protected function getSourceElement(): ?XmlElement
    {
        $list = $this->node->getElementsByTagNameNS(XliffFile::XLIFF_NS, 'source');
        if ($list->length && $element = $list->item(0)) {
            /** @var XmlElement $element */
            return $element;
        }

        return null;
    }
446349
public function fromXml(SimpleXMLElement $xmlElement)
    {
        $classname = $this->xmlElementToClassname($xmlElement);
        if (!is_null($classname)) {
            $return = new $classname();
            if ($return instanceof ArrayObject) {
                foreach ($xmlElement as $xmlChild) {
                    $return->append($this->fromXml($xmlChild));
                }
            } else {
                $objectData = array();
                foreach ($xmlElement as $xmlChild) {
                    $key = $this->xmlkeyToProperty($xmlChild->getName());
                    if (isset($objectData[$key])) {
                        if (!is_array($objectData[$key])) {
                            $objectData[$key] = array($objectData[$key]);
                        }
                        $objectData[$key][] = $this->fromXml($xmlChild);
                    } else {
                        $objectData[$key] = $this->fromXml($xmlChild);
                    }
                }
                $return->setData($objectData, false);
            }
        } else {
            $return = $this->castValue($xmlElement);
        }

        return $return;
    }
146011
public function getElements(By $by, Element $element = null)
    {
        try {
            $obj = null === $element ? $this->getBrowser() : $element;

            return $obj->elements($by);
        } catch (ExceptionInterface $e) {
            throw new \RuntimeException(sprintf('Error while searching for element "%s" : %s (visible text: "%s").', $by->toString(), $e->getMessage(), $this->getBrowser()->getText()));
        }
    }
384054
private Object parseXmlElement(Element element) {
        if(element.getFirstChild() instanceof Text) {
            Text text = (Text) element.getFirstChild();
            return text.getData();
        }
        return element;
    }
854812
public static function toSimpleXMLElement($xml)
    {
        if ($xml instanceof \SimpleXMLElement) {
            return $xml;
        }

        if ($xml instanceof \DOMDocument) {
            return simplexml_import_dom($xml);
        }

        if (is_string($xml)) {

            if (is_file($xml)) {
                return simplexml_load_file($xml);
            }

            return simplexml_load_string($xml);
        }

        $type = is_object($xml) ? get_class($xml) : gettype($xml);

        throw new \InvalidArgumentException("Cannot convert instance of '$type' to DOMDocument");
    }
190606
private function getCommonMessageProperties (SimpleXMLElement $xml)
    {
        return [
            (string)$xml->FromUserName,
            (string)$xml->ToUserName,
            (string)$xml->MsgId,
            (int)$xml->CreateTime
        ];
    }
839131
public function get_base($element = array())
	{
		if (!($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION) && !empty($element['xml_base_explicit']) && isset($element['xml_base']))
		{
			return $element['xml_base'];
		}
		elseif ($this->get_link() !== null)
		{
			return $this->get_link();
		}
		else
		{
			return $this->subscribe_url();
		}
	}