Builds a PickupLocation object from XML.

@param \DOMElement $xml
The xml element containing the pickup location.

@return PickupLocation
A PickupLocation object.
359742
public static function fromXml(\DOMElement $xml)
    {
        $static = new static();

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

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

        return $static;
    }
853336
public function inject(Xml $element)
	{
		$element->setAncestor($this->getAncestor());
		$element->setRoot($this->getRoot());
		$element->parent = $this;
		return $this->appendChild($element);
	}
409991
protected function unmarshall(DOMElement $element)
    {
        $node = $element->cloneNode(true);
        
        return new Sub($element->ownerDocument->saveXML($node));
    }
1315081
public function setXml($xml)
    {
        $class = $this->nodeClass;

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

        $this->xml = $xml;
        return $this;
    }
820
public function xml2array(\SimpleXMLElement $xml)
    {
        $arr = array();
        foreach ($xml as $element) {
            $tag = $element->getName();
            $e = get_object_vars($element);
            if (!empty($e)) {
                $arr[$tag][] = $element instanceof \SimpleXMLElement ? $this->xml2array($element) : $e;
            } else {
                $arr[$tag] = trim($element);
            }
        }

        return $arr;
    }
223302
public static function innerXML(DOMElement $element)
	{
		// Serialize the XML then remove the outer element
		$xml = $element->ownerDocument->saveXML($element);
		$pos = 1 + strpos($xml, '>');
		$len = strrpos($xml, '<') - $pos;

		// If the template is empty, return an empty string
		return ($len < 1) ? '' : substr($xml, $pos, $len);
	}
855150
public function getCdrResponse($xml)
    {
        $this->reader->loadXpath($xml);

        $cdr = $this->createCdr();

        return $cdr;
    }
134856
private function parseSubject(\DOMElement $xml) : void
    {
        /** @var \DOMElement[] $subject */
        $subject = Utils::xpQuery($xml, './saml_assertion:Subject');
        if (empty($subject)) {
            throw new \Exception('Missing subject in subject query.');
        } elseif (count($subject) > 1) {
            throw new \Exception('More than one <saml:Subject> in subject query.');
        }

        /** @var \DOMElement[] $nameId */
        $nameId = Utils::xpQuery($subject[0], './saml_assertion:NameID');
        if (empty($nameId)) {
            throw new \Exception('Missing <saml:NameID> in <saml:Subject>.');
        } elseif (count($nameId) > 1) {
            throw new \Exception('More than one <saml:NameID> in <saml:Subject>.');
        }
        $this->nameId = new NameID($nameId[0]);
    }
333877
public static function fromXml(\DOMNodeList $xml)
    {
        $value = 0;
        if ($xml->length > 0) {
            $value = (float) $xml->item(0)->textContent;
        }
        return new static($value);
    }
400864
private function parseElementAttributes(DOMElement $xml)
    {
        $attrs        = [];
        $elementAttrs = $xml->xpath('./@*');

        if (0 === $elementAttrs->length) {
            return $attrs;
        }

        foreach ($elementAttrs as $key => $attribute) {
            $value = static::getPhpValue($attribute->nodeValue, null, $this);
            $name = $this->normalizeKey($attribute->nodeName);
            $attrs[$this->prefixKey($name, $attribute->prefix ?: null)] = $value;
        }

        return [$this->getAttributesKey() => $attrs];
    }
1025713
private function getFormNode(\DOMElement $element)
    {
        if ($element->hasAttribute('form')) {
            $formId = $element->getAttribute('form');
            $formNode = $element->ownerDocument->getElementById($formId);

            if (null === $formNode || 'form' !== $formNode->nodeName) {
                throw new DriverException(sprintf('The selected node has an invalid form attribute (%s).', $formId));
            }

            return $formNode;
        }

        $formNode = $element;

        do {
            // use the ancestor form element
            if (null === $formNode = $formNode->parentNode) {
                throw new DriverException('The selected node does not have a form ancestor.');
            }
        } while ('form' !== $formNode->nodeName);

        return $formNode;
    }
554559
protected function process($xml)
    {
        if ($this->basedir) {
            $cwd = getcwd();
            chdir($this->basedir);
        }

        // Create and setup document.
        $xmlDom = new DomDocument();
        $xmlDom->resolveExternals = $this->resolveExternals;

        $xmlDom->loadXML($xml);

        $xmlDom->xinclude();

        if ($this->basedir) {
            chdir($cwd);
        }

        return $xmlDom->saveXML();
    }
926950
static public function xml2arr($xml)
    {
        $disableEntities = libxml_disable_entity_loader(true);
        $result = json_decode(Tools::json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
        libxml_disable_entity_loader($disableEntities);
        return $result;
    }
1048532
protected function parseXML($xml){
        $this->destinationList = array();
        if (!$xml){
            return false;
        }

        $i = 0;
        foreach ($xml->DestinationList->children() as $item) {
            $this->destinationList[$i]['DeliveryChannel'] = (string)$item->DeliveryChannel;

            foreach ($item->AttributeList->children() as $member) {
                $this->destinationList[$i]['AttributeList'][(string)$member->Key] = (string)$member->Value;
            }

            $i++;
        }
    }
582983
public function process(\DOMDocument $xml)
    {
        $ignoreQry = '//tag[@name=\'return\' and @type=\'self\']'
            . '|//tag[@name=\'return\' and @type=\'$this\']'
            . '|//tag[@name=\'return\']/type[.=\'self\']'
            . '|//tag[@name=\'return\']/type[.=\'$this\']';

        $xpath = new \DOMXPath($xml);
        $nodes = $xpath->query($ignoreQry);

        /** @var \DOMElement $node */
        foreach ($nodes as $node) {
            // if a node with name 'type' is selected we need to reach one
            // level further.
            $docblock = ($node->nodeName == 'type')
                ? $node->parentNode->parentNode
                : $node->parentNode;

            /** @var \DOMElement $method  */
            $method = $docblock->parentNode;

            // if the method is not a method but a global function: error!
            if ($method->nodeName != 'method') {
                continue;
            }

            $type = $method->parentNode->getElementsByTagName('full_name')
                ->item(0)->nodeValue;

            // nodes with name type need to set their content; otherwise we set
            // an attribute of the class itself
            if ($node->nodeName == 'type') {
                $node->nodeValue = $type;

                // add a new tag @fluent to indicate that this is a fluent interface
                // we only add it here since there should always be a node `type`
                $fluent_tag = new \DOMElement('tag');
                $docblock->appendChild($fluent_tag);
                $fluent_tag->setAttribute('name', 'fluent');
                $fluent_tag->setAttribute(
                    'description',
                    'This method is part of a fluent interface and will return '
                    . 'the same instance'
                );
            } else {
                $node->setAttribute('type', $type);
            }

            // check if an excerpt is set and override that as well
            if ($node->hasAttribute('excerpt')
                && (($node->getAttribute('excerpt') == 'self')
                || ($node->getAttribute('excerpt') == '$this'))
            ) {
                $node->setAttribute('excerpt', $type);
            }
        }

        return $xml;
    }
606404
public static function fromXML($xml)
    {
        $dom = new DOMDocument();
        $dom->loadXML($xml);
        $xpath = new DOMXPath($dom);
        $xpath->registerNamespace('a', self::getNamespace());
        $response = $xpath->query('//a:CaptureNotification');
        if ($response->length == 1) {
            return 
                new OffAmazonPaymentsNotifications_Model_CaptureNotification(
                    $response->item(0)
                );
        } else {
            throw new Exception(
                "Unable to construct " .
                "OffAmazonPaymentsNotifications_Model_CaptureNotification" .
                "from provided XML. Make sure that CaptureNotification" .
                "is a root element"
            );
        }
    }
925330
public static function createByXml(\SimpleXMLElement $xml, \SplPriorityQueue $namespaces = null)
    {
        $type = (string) XmlHelper::get($xml, 'type', 'text');

        if (class_exists($type)) {
            $class = $type;
        } else {
            $class = (string) static::findFieldClass($type, $namespaces);
        }

        if (!class_exists($class)) {
            // Fallback to TextField
            $class = static::$defaultNamespace . '\\TextField';
        }

        return new $class($xml);
    }