Create this EntityDescriptor.

@param \DOMElement|null $parent The EntitiesDescriptor we should append this EntityDescriptor to.
@return \DOMElement
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;
    }
880132
public function toXML(DOMElement $parent = null) : DOMElement
    {
        if (($this->Saml2IssuerShowAll && ($this->Format === Constants::NAMEID_ENTITY))
            || ($this->Format !== Constants::NAMEID_ENTITY)
        ) {
            return parent::toXML($parent);
        }

        /*
         * if $this->Saml2IssuerShowAll is set false
         * From saml-core-2.0-os 8.3.6, when the entity Format is used: "The NameQualifier, SPNameQualifier, and
         * SPProvidedID attributes MUST be omitted."
         * if $this->isSaml2IssuerShowAll() is set true when the entity Format is used: "The NameQualifier,
         * SPNameQualifier, and SPProvidedID attributes are not omitted."
         */

        if ($parent === null) {
            $parent = DOMDocumentFactory::create();
            $doc = $parent;
        } else {
            $doc = $parent->ownerDocument;
        }
        $element = $doc->createElementNS(Constants::NS_SAML, 'saml:Issuer');
        $parent->appendChild($element);

        if (empty($this->value)) {
            throw new \Exception("Cannot convert Issuer to XML with no value.");
        }
        $value = $element->ownerDocument->createTextNode($this->value);
        $element->appendChild($value);

        return $element;
    }
1054291
public function toXML(DOMElement $parent) : DOMElement
    {
        Assert::notEmpty($this->scope);

        $doc = $parent->ownerDocument;

        $e = $doc->createElementNS(Scope::NS, 'shibmd:Scope');
        $parent->appendChild($e);

        $e->appendChild($doc->createTextNode($this->scope));

        if ($this->regexp === true) {
            $e->setAttribute('regexp', 'true');
        } else {
            $e->setAttribute('regexp', 'false');
        }

        return $e;
    }
1044967
public function convert(\DOMElement $parent, MethodDescriptor $method)
    {
        $fullyQualifiedNamespaceName = $method->getNamespace() instanceof NamespaceDescriptor
            ? $method->getNamespace()->getFullyQualifiedStructuralElementName()
            : $parent->getAttribute('namespace');

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

        $child->setAttribute('final', var_export($method->isFinal(), true));
        $child->setAttribute('abstract', var_export($method->isAbstract(), true));
        $child->setAttribute('static', var_export($method->isStatic(), true));
        $child->setAttribute('visibility', $method->getVisibility());
        $child->setAttribute('namespace', $fullyQualifiedNamespaceName);
        $child->setAttribute('line', (string) $method->getLine());

        $child->appendChild(new \DOMElement('name', $method->getName()));
        $child->appendChild(new \DOMElement('full_name', $method->getFullyQualifiedStructuralElementName()));

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

        foreach ($method->getArguments() as $argument) {
            $this->argumentConverter->convert($child, $argument);
        }

        return $child;
    }
1238437
public function toXML(DOMElement $parent) : DOMElement
    {
        Assert::notNull($this->Method, "Cannot convert SubjectConfirmation to XML without a Method set.");

        $e = $parent->ownerDocument->createElementNS(Constants::NS_SAML, 'saml:SubjectConfirmation');
        $parent->appendChild($e);

        /** @psalm-suppress PossiblyNullArgument */
        $e->setAttribute('Method', $this->Method);

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

        return $e;
    }
379974
public function toXML(DOMElement $parent) : DOMElement
    {
        $e = Utils::addString($parent, Constants::NS_MD, 'md:AdditionalMetadataLocation', $this->getLocation());
        $e->setAttribute('namespace', $this->getNamespace());

        return $e;
    }
286381
public function build(SimpleXMLElement $parent = null) : SimpleXMLElement
    {
        if ($parent === null) {
            $xml = new SimpleXMLElement('<' . get_called_class()::getTagName() . "/>", LIBXML_PARSEHUGE);
        } else {
            $xml = $parent->addChild(get_called_class()::getTagName());
        }
        $this->setAttributes($xml);
        $this->setChilds($xml);

        return $xml;
    }
626051
public function setParent(\Haven\CmsBundle\Entity\Page $parent = null) {
        $this->parent = $parent;

        return $this;
    }
290334
public function parseElement(Node $parent, \DOMElement $element)
    {
        if (Atom::NS !== $element->namespaceURI) {
            return null;
        }

        $name = 'atom:' . $element->localName;
        if (array_key_exists($name, $this->elementMap)) {
            $class = $this->elementMap[$name];

            return new $class($parent, $element);
        }

        return null;
    }
1331466
public function setParent(\Haven\PersonaBundle\Entity\Country $parent = null)
    {
        $this->parent = $parent;
    
        return $this;
    }
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;
    }
1034219
public function createView(NavigationView $parent = null)
    {
        $options = $this->getConfig()->getOptions();

        $view = $this->newView($parent);
        $this->config->getType()->buildView($view, $this, $options);

        foreach ($this->children as $name => $child) {
            /* @var NavigationInterface $child */
            $view->children[$name] = $child->createView($view);
        }

        return $view;
    }
955055
public function setParent(\Coral\ContentBundle\Entity\Node $parent)
    {
        $this->parent = $parent;

        return $this;
    }
317951
public function getParentEntityDescriptor()
    {
        if (is_null($this->parentEntityDescriptor)) {
            $this->setParentEntityDescriptor(
                EntityDescriptorRegistry::getInstance()
                    ->getDescriptorFor($this->parentEntity)
            );
        }
        return $this->parentEntityDescriptor;
    }
643112
public function createElement(Node $parent, $name)
    {
        foreach ($this->registry[ElementExtension::class] as $extension) {
            $node = $extension->createElement($parent, $name);
            if ($node) {
                return $node;
            }
        }

        return null;
    }
853457
protected function writeArgs(DOMElement $parent)
    {
        $args = $this->getArgs();
        if (count($args) > 0) {
            $dom = $parent->ownerDocument;
            $argBase = $dom->createElement('arg');
            foreach ($args as $key => $value) {
                $arg = clone $argBase;
                $arg->setAttribute('name', $key);

                if ($this instanceof CustomArgInterface && $this->flagUseCustomArgWriter($key, $value)) {
                    $this->buildArgValue($key, $value, $arg);
                } else {
                    $valueArgElement = $dom->createTextNode($value);
                    $arg->appendChild($valueArgElement);
                }

                $parent->appendChild($arg);
            }
        }
    }
145594
private function setParent(&$parent)
    {
        if (! is_null($parent)) {
            $this->parent = $parent;

            $this->parent->elements->add($this);
        }

        return $this;
    }