Creates an ATOM ENTRY instance with specified simpleXML object.

@param \SimpleXMLElement $entryXml xml element of ATOM ENTRY
964842
public function fromXml(\SimpleXMLElement $entryXml)
    {
        Validate::notNull($entryXml, 'entryXml');

        $this->attributes = (array) $entryXml->attributes();
        $entryArray = (array) $entryXml;

        if (array_key_exists(Resources::AUTHOR, $entryArray)) {
            $this->author = $this->processAuthorNode($entryArray);
        }

        if (array_key_exists(Resources::CATEGORY, $entryArray)) {
            $this->category = $this->processCategoryNode($entryArray);
        }

        if (array_key_exists('content', $entryArray)) {
            $content = new Content();
            $content->fromXml($entryArray['content']);
            $this->content = $content;
        }

        if (array_key_exists(Resources::CONTRIBUTOR, $entryArray)) {
            $this->contributor = $this->processContributorNode($entryArray);
        }

        if (array_key_exists('id', $entryArray)) {
            $this->id = (string) $entryArray['id'];
        }

        if (array_key_exists(Resources::LINK, $entryArray)) {
            $this->link = $this->processLinkNode($entryArray);
        }

        if (array_key_exists('published', $entryArray)) {
            $this->published = $entryArray['published'];
        }

        if (array_key_exists('rights', $entryArray)) {
            $this->rights = $entryArray['rights'];
        }

        if (array_key_exists('source', $entryArray)) {
            $source = new Source();
            $source->parseXml($entryArray['source']->asXML());
            $this->source = $source;
        }

        if (array_key_exists('title', $entryArray)) {
            $this->title = $entryArray['title'];
        }

        if (array_key_exists('updated', $entryArray)) {
            $this->updated = \DateTime::createFromFormat(
                \DateTime::ATOM,
                (string) $entryArray['updated']
            );
        }
    }
620140
private function _asXml($simpleXml)
    {
        $dom = new \DOMDocument('1.0', 'UTF-8');
        $dom->loadXML($simpleXml->asXML());
        $dom->formatOutput = true;

        return $dom->saveXML();
    }
659228
public function createFromXml(XmlElement $xml): TrackInterface
    {
        $uri = (string) $xml->getTag("res");
        $class = $this->guessTrackClass($uri);

        return $class::createFromXml($xml, $this->controller);
    }
112141
public static function fromXml(\DOMElement $xml)
    {
        $static = new static();

        $title = $xml->getElementsByTagName('title');
        $static->title = StringLiteral::fromXml($title);

        $author = $xml->getElementsByTagName('author');
        $static->author = StringLiteral::fromXml($author);

        $year = $xml->getElementsByTagName('year');
        $static->year = StringLiteral::fromXml($year);

        $imprint = $xml->getElementsByTagName('imprint');
        $static->imprint = StringLiteral::fromXml($imprint);

        $url = $xml->getElementsByTagName('docUrl');
        $static->url = Path::fromXml($url);

        $isbnIssn = $xml->getElementsByTagName('isbn_issn');
        $static->isbnIssn = StringLiteral::fromXml($isbnIssn);

        $docNumber = $xml->getElementsByTagName('docNumber');
        $static->docNumber = StringLiteral::fromXml($docNumber);

        $itemId = $xml->getElementsByTagName('itemId');
        $static->itemId = StringLiteral::fromXml($itemId);

        return $static;
    }
1315081
public function setXml($xml)
    {
        $class = $this->nodeClass;

        if (!$xml instanceof $class) {
            $xml = new $class((string)$xml);
        }

        $this->xml = $xml;
        return $this;
    }
331367
protected function processEntryNode($xmlArray)
    {
        $entry = [];
        $entryItem = $xmlArray[Resources::ENTRY];

        if (is_array($entryItem)) {
            foreach ($xmlArray[Resources::ENTRY] as $entryXmlInstance) {
                $entryInstance = new Entry();
                $entryInstance->fromXml($entryXmlInstance);
                $entry[] = $entryInstance;
            }
        } else {
            $entryInstance = new Entry();
            $entryInstance->fromXml($entryItem);
            $entry[] = $entryInstance;
        }

        return $entry;
    }
66442
private function createRootElement($xml)
    {
        $root = $xml->createElement('entity');
        $root->setAttribute('name', $this->class);
        $root->setAttribute('role', $this->role);
        $xml->appendChild($root);

        return $root;
    }
717501
public function appendChildNode(\SimpleXMLElement $element)
    {
        $target  = dom_import_simplexml($this);
        $insert = $target->ownerDocument->importNode(dom_import_simplexml($element), true);
        $target->appendChild($insert);
    }
333877
public static function fromXml(\DOMNodeList $xml)
    {
        $value = 0;
        if ($xml->length > 0) {
            $value = (float) $xml->item(0)->textContent;
        }
        return new static($value);
    }
1334063
private function createDomDocument($xml)
    {
        $domDocument = new \DOMDocument();
        if ($domDocument->loadXML($xml) === false) {
            throw new ParseException("Could not parse xml input");
        }
        return $domDocument;
    }
180175
private function createOptionElement($xml, $key, $value)
    {
        $option = $xml->createElement('option');
        $this->addAttributes($option, ['value' => $key]);

        $text = $xml->createTextNode($value);
        $option->appendChild($text);

        return $option;
    }
853336
public function inject(Xml $element)
	{
		$element->setAncestor($this->getAncestor());
		$element->setRoot($this->getRoot());
		$element->parent = $this;
		return $this->appendChild($element);
	}
1164724
protected static function xmlToArray(\SimpleXMLElement $xml)/*# : array */
    {
        $arr = array();
        foreach ($xml as $element) {
            $tag = $element->getName();
            $ele = get_object_vars($element);
            if (!empty($ele)) {
                $arr[$tag] = $element instanceof \SimpleXMLElement ?
                    static::xmlToArray($element) :
                    $ele;
            } else {
                $arr[$tag] = trim($element);
            }
        }
        return $arr;
    }
574278
private function createRelationsElement($xml)
    {
        $relations = $xml->createElement('relations');

        foreach ($this->relations as $type => $rr) {
            foreach ($rr as $relation) {
                $relations->appendChild($this->createRelationElement($xml, $type, $relation));
            }
        }

        return $relations;
    }
453498
protected function handleXml(\SimpleXMLElement $xml)
    {
        $this->name = XmlHelper::get($xml, 'name');
        $this->label = XmlHelper::get($xml, 'label');

        $this->attributes = XmlHelper::getAttributes($xml);

        $form = $xml;

        $group = [];

        while ($parent = $form->xpath('..')) {
            $parent = $parent[0];

            $name = $parent->getName();

            if ($name === 'fieldset') {
                $this->fieldset = $this->fieldset ?: (string) $parent['name'];
            } elseif ($name === 'group') {
                array_unshift($group, (string) $parent['name']);
            }

            $form = $parent;
        }

        $this->group = implode('/', $group);
    }
282089
protected function xmlToCreate(\SimpleXMLElement $table)
	{
		$existingTables = $this->db->getTableList();
		$tableName      = (string) $table['name'];

		if (\in_array($tableName, $existingTables, true))
		{
			throw new \RuntimeException('The table you are trying to create already exists');
		}

		$createTableStatement = 'CREATE TABLE ' . $this->db->quoteName($tableName) . ' (';

		foreach ($table->xpath('field') as $field)
		{
			$createTableStatement .= $this->getColumnSQL($field) . ', ';
		}

		foreach ($table->xpath('key') as $key)
		{
			$createTableStatement .= $this->getKeySQL(array($key)) . ', ';
		}

		$createTableStatement = rtrim($createTableStatement, ', ');

		$createTableStatement .= ')';

		return $createTableStatement;
	}
1158247
public function build (SimpleXMLElement $xml)
    {
        // Start parsing the input.
        $function = preg_replace_callback('/(_)([a-z])/', function ($matches) {
            return strtoupper($matches[1]);
        }, strtolower($xml->MsgType));
        $callable = [$this, "parse{$function}Input"];

        if (is_callable($callable)) {
            $input = call_user_func($callable, $xml);
        } else {
            throw new UnknownInputTypeException($xml->MsgType);
        }
        
        return $input;
    }