Export the given reflected constant definition to the provided parent element.

@param \DOMElement        $parent Element to augment.
@param ConstantDescriptor $constant Element to export.

@return \DOMElement
8986
public function convert(\DOMElement $parent, ConstantDescriptor $constant)
    {
        $fullyQualifiedNamespaceName = $constant->getNamespace() instanceof NamespaceDescriptor
            ? $constant->getNamespace()->getFullyQualifiedStructuralElementName()
            : $parent->getAttribute('namespace');

        $child = new \DOMElement('constant');
        $parent->appendChild($child);

        $child->setAttribute('namespace', ltrim($fullyQualifiedNamespaceName, '\\'));
        $child->setAttribute('line', $constant->getLine());

        $child->appendChild(new \DOMElement('name', $constant->getName()));
        $child->appendChild(new \DOMElement('full_name', $constant->getFullyQualifiedStructuralElementName()));
        $child->appendChild(new \DOMElement('value'))->appendChild(new \DOMText($constant->getValue()));

        $this->docBlockConverter->convert($child, $constant);

        return $child;
    }
431906
final public function parent(string $parent)
    {
        if (!$this->allowParent) {
            throw new InvalidArgumentException(sprintf('A parent cannot be defined when either "_instanceof" or "_defaults" are also defined for service prototype "%s".', $this->id));
        }

        if ($this->definition instanceof ChildDefinition) {
            $this->definition->setParent($parent);
        } elseif ($this->definition->isAutoconfigured()) {
            throw new InvalidArgumentException(sprintf('The service "%s" cannot have a "parent" and also have "autoconfigure". Try disabling autoconfiguration for the service.', $this->id));
        } elseif ($this->definition->getBindings()) {
            throw new InvalidArgumentException(sprintf('The service "%s" cannot have a "parent" and also "bind" arguments.', $this->id));
        } else {
            // cast Definition to ChildDefinition
            $definition = serialize($this->definition);
            $definition = substr_replace($definition, '53', 2, 2);
            $definition = substr_replace($definition, 'Child', 44, 0);
            $definition = unserialize($definition);

            $this->definition = $definition->setParent($parent);
        }

        return $this;
    }
617869
public function parseElements(array $elements, ElementInterface $parent = null)
    {
        foreach ($elements as $element) {
            try {
                $object = $this->elementFactory->make($element['name']);
            } catch (InvalidElementException $e) {
                $object = $this->getReservation($element['name']);
            }

            // Set some stuff
            $object->setCollection($this->collection);
            $object->setAttributes($element['attributes']);

            if ( ! is_array($element['value'])) {
                $object->setValue(trim($element['value']));
            }

            // Add the object to the collection
            $this->collection->add($object);

            if ($parent) {
                $object->setParent($parent);
                $parent->addChild($object);
            }

            if (is_array($element['value'])) {
                $this->parseElements($element['value'], $object);
            }

            // Initialize object
            $object->init();

            if ($object instanceof ReservationInterface) {
                $object = $object->getElement($this, $parent);
            }

            $data[] = $object;
        }

        return $data;
    }
265453
protected function addDescription(\DOMElement $node, DescriptorAbstract $element)
    {
        $node->appendChild(new \DOMElement('long-description'))
            ->appendChild(new \DOMText($element->getDescription()));
    }
1254961
public function createStepDescriptor(DOMElement $step = null, AbstractDescriptor $parent = null)
    {
        return new StepDescriptor($step, $parent);
    }
81618
public static function export($item) {
    if ($item instanceof DOMDocument) {
      $out = $item->saveXML();
    } elseif ($item instanceof DOMNodeList) {
      $out = array();
      foreach ($item as $node) {
        $out[] = self::export($node);
      }
    } elseif ($item instanceof DOMElement || $item instanceof DOMComment) {
      $out = $item->ownerDocument->saveXML($item);
    } elseif ($item instanceof DOMText) {
      $out = $item->wholeText;
    } elseif (is_array($item)) {
      $out = array();
      foreach ($item as $node) {
        $out[] = self::export($node);
      }
    } else {
      $out = $item;
    }
    
    return $out;
  }
642155
public function toXML(DOMElement $parent) : DOMElement
    {
        $doc = $parent->ownerDocument;

        $e = $doc->createElementNS(XMLSecurityDSig::XMLDSIGNS, 'ds:KeyInfo');
        $parent->appendChild($e);

        if ($this->Id !== null) {
            $e->setAttribute('Id', $this->Id);
        }

        foreach ($this->info as $n) {
            $n->toXML($e);
        }

        return $e;
    }
635349
public function toXML(DOMElement $parent) : DOMElement
    {
        $e = $parent->ownerDocument->createElementNS(Constants::NS_SAML, 'saml:SubjectConfirmationData');
        $parent->appendChild($e);

        if ($this->NotBefore !== null) {
            $e->setAttribute('NotBefore', gmdate('Y-m-d\TH:i:s\Z', $this->NotBefore));
        }
        if ($this->NotOnOrAfter !== null) {
            $e->setAttribute('NotOnOrAfter', gmdate('Y-m-d\TH:i:s\Z', $this->NotOnOrAfter));
        }
        if ($this->Recipient !== null) {
            $e->setAttribute('Recipient', $this->Recipient);
        }
        if ($this->InResponseTo !== null) {
            $e->setAttribute('InResponseTo', $this->InResponseTo);
        }
        if ($this->Address !== null) {
            $e->setAttribute('Address', $this->Address);
        }
        /** @var \SAML2\XML\ds\KeyInfo|\SAML2\XML\Chunk $n */
        foreach ($this->getInfo() as $n) {
            $n->toXML($e);
        }

        return $e;
    }
384809
public function toXML(DOMElement $parent) : DOMElement
    {
        $doc = $parent->ownerDocument;

        $e = $doc->createElementNS(Constants::NS_MD, 'md:AttributeConsumingService');
        $parent->appendChild($e);

        $e->setAttribute('index', strval($this->getIndex()));

        if ($this->getIsDefault() === true) {
            $e->setAttribute('isDefault', 'true');
        } elseif ($this->getIsDefault() === false) {
            $e->setAttribute('isDefault', 'false');
        }

        Utils::addStrings($e, Constants::NS_MD, 'md:ServiceName', true, $this->getServiceName());
        Utils::addStrings($e, Constants::NS_MD, 'md:ServiceDescription', true, $this->getServiceDescription());

        foreach ($this->getRequestedAttribute() as $ra) {
            $ra->toXML($e);
        }

        return $e;
    }
114890
public function toXML(DOMNode $parentElement = null) : DOMElement
    {
        if ($parentElement === null) {
            $document = DOMDocumentFactory::create();
            $parentElement = $document;
        } else {
            $document = $parentElement->ownerDocument;
        }

        $root = $document->createElementNS(Constants::NS_SAML, 'saml:'.'EncryptedAssertion');
        $parentElement->appendChild($root);

        $root->appendChild($document->importNode($this->encryptedData, true));

        return $root;
    }
831572
public function processElement(\DOMElement $element, ContextInterface $context)
    {
        // Create a property
        $propertyContext = $this->processProperty($element, $context);

        // Process the element in case it's an anonymous thing with no children
        if (!$element->childNodes->length) {
            $this->processChild($element, $context);
        }

        return $propertyContext;
    }
739846
protected static function objectOutput(\stdClass $object, \DOMDocument $dom, \DOMElement $parentUL)
    {
        foreach($object as $k=>$v)
        {
            $li = $dom->createElement('li');
            $parentUL->appendChild($li);
            $strong = $dom->createElement('strong', $k);
            $li->appendChild($strong);
            if ($v instanceof \stdClass)
            {
                $ul = $dom->createElement('ul');
                $li->appendChild($ul);
                self::objectOutput($v, $dom, $ul);
            }
            else if (is_array($v))
            {
                $ul = $dom->createElement('ul');
                $li->appendChild($ul);
                self::arrayOutput($v, $dom, $ul);
            }
            else if (is_bool($v))
            {
                switch($v)
                {
                    case true: $li->appendChild($dom->createTextNode(' TRUE')); break;
                    case false: $li->appendChild($dom->createTextNode(' FALSE')); break;
                }
            }
            else if (is_scalar($v))
            {
                $span = $dom->createElement('span');
                $span->appendChild($dom->createTextNode(' '.strval($v)));
                $li->appendChild($span);
            }
        }
        return $dom;
    }
952770
protected function appendAVT(DOMElement $parentNode, $avt)
	{
		foreach (AVTHelper::parse($avt) as $token)
		{
			if ($token[0] === 'expression')
			{
				$this->appendXPathOutput($parentNode, $token[1]);
			}
			else
			{
				$this->appendLiteralOutput($parentNode, $token[1]);
			}
		}
	}
469277
public function toXML(DOMElement $parent) : DOMElement
    {
        Assert::notEmpty($this->publisher, "Cannot convert PublicationInfo to XML without a publisher set.");

        $doc = $parent->ownerDocument;

        $e = $doc->createElementNS(Common::NS_MDRPI, 'mdrpi:PublicationInfo');
        $parent->appendChild($e);

        $e->setAttribute('publisher', $this->publisher);

        if ($this->creationInstant !== null) {
            $e->setAttribute('creationInstant', gmdate('Y-m-d\TH:i:s\Z', $this->creationInstant));
        }

        if ($this->publicationId !== null) {
            $e->setAttribute('publicationId', $this->publicationId);
        }

        Utils::addStrings($e, Common::NS_MDRPI, 'mdrpi:UsagePolicy', true, $this->UsagePolicy);

        return $e;
    }
499111
public function toXML(DOMElement $parent) : DOMElement
    {
        Assert::stringNotEmpty($this->Algorithm, 'Cannot convert DigestMethod to XML without an Algorithm set.');

        $doc = $parent->ownerDocument;
        $e = $doc->createElementNS(Common::NS, 'alg:DigestMethod');
        $parent->appendChild($e);
        $e->setAttribute('Algorithm', $this->Algorithm);

        return $e;
    }
918921
protected static function childTagCount( DOMElement $parent )
    {
        $count = 0;
        foreach( $parent->childNodes as $child )
        {
            if ( $child instanceof DOMElement ) $count++;
        }
        return $count;
    }
186223
public function toXML(DOMElement $parent = null) : DOMElement
    {
        if (empty($this->entityID)) {
            throw new \Exception('Cannot convert EntityDescriptor to XML without an EntityID set.');
        }

        if ($parent === null) {
            $doc = DOMDocumentFactory::create();
            $e = $doc->createElementNS(Constants::NS_MD, 'md:EntityDescriptor');
            $doc->appendChild($e);
        } else {
            $e = $parent->ownerDocument->createElementNS(Constants::NS_MD, 'md:EntityDescriptor');
            $parent->appendChild($e);
        }

        $e->setAttribute('entityID', $this->entityID);

        if ($this->ID !== null) {
            $e->setAttribute('ID', $this->ID);
        }

        if ($this->validUntil !== null) {
            $e->setAttribute('validUntil', gmdate('Y-m-d\TH:i:s\Z', $this->validUntil));
        }

        if ($this->cacheDuration !== null) {
            $e->setAttribute('cacheDuration', $this->cacheDuration);
        }

        Extensions::addList($e, $this->Extensions);

        foreach ($this->RoleDescriptor as $n) {
            $n->toXML($e);
        }

        if ($this->AffiliationDescriptor !== null) {
            $this->AffiliationDescriptor->toXML($e);
        }

        if ($this->Organization !== null) {
            $this->Organization->toXML($e);
        }

        foreach ($this->ContactPerson as $cp) {
            $cp->toXML($e);
        }

        foreach ($this->AdditionalMetadataLocation as $n) {
            $n->toXML($e);
        }

        /** @var \DOMElement $child */
        $child = $e->firstChild;
        $this->signElement($e, $child);

        return $e;
    }