Evaluate the rule for the current tag name.

This may modify the existing DOM.

@return \DOMElement The new Current DOM element.
322807
public function evaluate($new, $current) {
        switch ($new->tagName) {
            case 'li':
                return $this->handleLI($new, $current);
            case 'dt':
            case 'dd':
                return $this->handleDT($new, $current);
            case 'rt':
            case 'rp':
                return $this->handleRT($new, $current);
            case 'optgroup':
                return $this->closeIfCurrentMatches($new, $current, array(
                            'optgroup'
                ));
            case 'option':
                return $this->closeIfCurrentMatches($new, $current, array(
                            'option',
                            'optgroup'
                ));
            case 'tr':
                return $this->closeIfCurrentMatches($new, $current, array(
                            'tr'
                ));
            case 'td':
            case 'th':
                return $this->closeIfCurrentMatches($new, $current, array(
                            'th',
                            'td'
                ));
            case 'tbody':
            case 'thead':
            case 'tfoot':
            case 'table': // Spec isn't explicit about this, but it's necessary.

                return $this->closeIfCurrentMatches($new, $current, array(
                            'thead',
                            'tfoot',
                            'tbody'
                ));
        }

        return $current;
    }
55296
public function getTag()
    {
        if (null === $this->_tag) {
            $tag = $this->getOption('tag');
            if (null !== $tag) {
                $this->removeOption('tag');
            } else {
                $tag = 'span';
            }

            $this->setTag($tag);
            return $tag;
        }

        return $this->_tag;
    }
723110
public function toUnsignedXML() : DOMElement
    {
        $root = parent::toUnsignedXML();

        foreach ($this->attributes as $name => $values) {
            $attribute = $root->ownerDocument->createElementNS(Constants::NS_SAML, 'saml:Attribute');
            $root->appendChild($attribute);
            $attribute->setAttribute('Name', $name);

            if ($this->nameFormat !== Constants::NAMEFORMAT_UNSPECIFIED) {
                $attribute->setAttribute('NameFormat', $this->nameFormat);
            }

            foreach ($values as $value) {
                if (is_string($value)) {
                    $type = 'xs:string';
                } elseif (is_int($value)) {
                    $type = 'xs:integer';
                } else {
                    $type = null;
                }

                $attributeValue = Utils::addString(
                    $attribute,
                    Constants::NS_SAML,
                    'saml:AttributeValue',
                    strval($value)
                );
                if ($type !== null) {
                    $attributeValue->setAttributeNS(Constants::NS_XSI, 'xsi:type', $type);
                }
            }
        }

        return $root;
    }
1019140
public function toSignedXML() : DOMElement
    {
        $root = $this->toUnsignedXML();

        if ($this->signatureKey === null) {
            /* We don't have a key to sign it with. */

            return $root;
        }

        /* Find the position we should insert the signature node at. */
        if ($this->issuer !== null) {
            /*
             * We have an issuer node. The signature node should come
             * after the issuer node.
             */
            $issuerNode = $root->firstChild;
            $insertBefore = $issuerNode->nextSibling;
        } else {
            /* No issuer node - the signature element should be the first element. */
            $insertBefore = $root->firstChild;
        }

        Utils::insertSignature($this->signatureKey, $this->certificates, $root, $insertBefore);

        return $root;
    }
1128055
public function getUserNameElement()
    {
        $element = $this->getElement($this->usernameFieldName);

        if (! $element) {
            // Veld inlognaam
            $element = $this->createElement('text', $this->usernameFieldName);
            $element->setLabel($this->translate->_('Username'));
            $element->setAttrib('size', 40);
            $element->setRequired(true);

            $this->addElement($element);
        }

        return $element;
    }
334206
public static function getInnerHtml(\DOMElement $element) {
    $innerHTML= '';
    $children = $element->childNodes;
    foreach ($children as $child) {
      $innerHTML .= $child->ownerDocument->saveXML( $child );
    }
    return $innerHTML;
  }
1003918
public function getHTML() {
        $tag = "<" . $this->name;
        $q = $this->quoteType;

        //build attribute strings
        foreach( $this->attrs as $name=>$value ) {
            //if true, such as CHECKED, we just add the name
            if( $value === true ) {
                $tag .= " $name";
            } else if( is_string( $value ) ) { //if it's a string, we add attr="value"
                $tag .= " {$name}={$q}{$value}{$q}";
            }
        }

        //short tag? close it and return
        if( $this->isShortTag ) {
            $tag .= ' />';
            
            return $tag;
        }

        //not a short tag, close it
        $tag .= '>';

        //add the children if they exist
        if( $this->hasChildren() ) {
            foreach( $this->getChildren() as $child ) {
                $tag .= $child->getHTML();
            }
        }

        //closing tag
        $tag .= "</{$this->name}>";

        return $tag;
    }
386045
public function getElementId()
    {
        $id = $this->getAttribute('elementId');
        if (null === $id && null !== $this->element) {
            $id = $this->elementId = $this->element->id;
        }

        return $id;
    }
104889
protected function replaceElement(DOMElement $element)
	{
		$elName = $this->lowercase($element->localName);
		if ($elName === $element->localName)
		{
			return;
		}

		// Create a new element with the correct name
		$newElement = (is_null($element->namespaceURI))
		            ? $this->ownerDocument->createElement($elName)
		            : $this->ownerDocument->createElementNS($element->namespaceURI, $elName);

		// Move every child to the new element
		while ($element->firstChild)
		{
			$newElement->appendChild($element->removeChild($element->firstChild));
		}

		// Copy attributes to the new node
		foreach ($element->attributes as $attribute)
		{
			$newElement->setAttributeNS(
				$attribute->namespaceURI,
				$attribute->nodeName,
				$attribute->value
			);
		}

		// Replace the old element with the new one
		$element->parentNode->replaceChild($newElement, $element);
	}
866184
public static function dom(){
        $attr = self::$attr;
//        $attr['param'] = self::strToArray($attr['param']);
//        p($attr['param']);

        $label = explode('|',$attr['label']);
        $linkfield = explode('|',$attr['linkfield']);

        $str = '';
        foreach($label as $k => $v){

            $str .= <<<EOT
    <label class="layui-form-label">{$v}</label>
    <div class="layui-input-inline">
        <select name="{$linkfield[$k]}" lay-verify="{$attr['layVerify']}" >
            <option value="">请选择</option>
        </select>
    </div>
EOT;

        }

        $dom = <<<EOT
            <div class="layui-form-item {$attr['component_name']}" component-name="linkselect" id="{$attr['id']}">
                    {$str}
                    <div class="layui-form-mid layui-word-aux">{$attr['helpinfo']}</div>
                </div>
EOT;

        return $dom;
    }
1288462
protected function tagName() {
        $tok = $this->scanner->current();
        if (!ctype_alpha($tok)) {
            return false;
        }

        // We know this is at least one char.
        $name = strtolower($this->scanner->charsWhile(":_-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
        $attributes = array();
        $selfClose = false;

        // Handle attribute parse exceptions here so that we can
        // react by trying to build a sensible parse tree.
        try {
            do {
                $this->scanner->whitespace();
                $this->attribute($attributes);
            } while (!$this->isTagEnd($selfClose));
        } catch (HTML5_Parser_Exception $e) {
            $selfClose = false;
        }

        $mode = $this->events->startTag($name, $attributes, $selfClose);
        // Should we do this? What does this buy that selfClose doesn't?
        if ($selfClose) {
            $this->events->endTag($name);
        } elseif (is_int($mode)) {
            // fprintf(STDOUT, "Event response says move into mode %d for tag %s", $mode, $name);
            $this->setTextMode($mode, $name);
        }

        $this->scanner->next();

        return true;
    }
1138409
public function getSchemaInfo()
	{
		if ( is_null( $this->domNode ) ) return null;

		switch( $this->domNode->nodeType )
		{
			case XML_ATTRIBUTE_NODE:
			case XML_ELEMENT_NODE:
				return new DOMName( $this->domNode );

			case XML_TEXT_NODE:
				return new DOMName( $this->domNode->parentNode );

			default:
				return new DOMSchemaInfo( $this->domNode );
		}
	}
1292973
function (elm, name) {
        var self = this, newElm;

        if (elm.nodeName != name.toUpperCase()) {
          // Rename block element
          newElm = self.create(name);

          // Copy attribs to new block
          each(self.getAttribs(elm), function (attrNode) {
            self.setAttrib(newElm, attrNode.nodeName, self.getAttrib(elm, attrNode.nodeName));
          });

          // Replace block
          self.replace(newElm, elm, 1);
        }

        return newElm || elm;
      }
107062
function modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement )
    {
        $dom = $namedParameters['dom'];
        if ( $dom instanceof eZContentObjectAttribute )
        {
            $this->ObjectAttributeId = $dom->attribute( 'id' );
            $content = $dom->attribute( 'content' );
            $xmlData = $content->attribute( 'xml_data' );

            $domTree = new DOMDocument( '1.0', 'utf-8' );
            $domTree->preserveWhiteSpace = false;
            $success = $domTree->loadXML( $xmlData );

            $tocText = '';
            if ( $success )
            {
                $this->HeaderCounter = array();
                $this->LastHeaderLevel = 0;

                $rootNode = $domTree->documentElement;
                $tocText .= $this->handleSection( $rootNode );

                while ( $this->LastHeaderLevel > 0 )
                {
                    $tocText .= "</li>\n</ul>\n";
                    $this->LastHeaderLevel--;
                }
            }
        }
        $operatorValue = $tocText;
    }
1288106
public function getHeadNode()
    {
        $head = $this->dom->getElementsByTagName('head')->item(0);
        if ($head == null) {
            $head = $this->dom->createElement('head');
            $head = $this->dom->documentElement->insertBefore($head, $this->getBodyNode());
        }
        return $head;
    }
1208755
public function toUnsignedXML() : DOMElement
    {
        $root = parent::toUnsignedXML();

        /** @var \SAML2\Assertion|\SAML2\EncryptedAssertion $assertion */
        foreach ($this->assertions as $assertion) {
            $assertion->toXML($root);
        }

        return $root;
    }
916454
public function convertDOM($domElement) {

        $value = "";

        // Deal with straightforward primitives first.  These occur when a text node is passed
        if ($domElement instanceof \DOMText || $domElement instanceof \DOMAttr) {

            // Get the value
            $value = utf8_decode($domElement->nodeValue);

            // Handle booleans as special case
            if (strtolower($value) == "true") {
                $value = true;
            } elseif (strtolower($value) == "false") {
                $value = false;
            }

        } // Now deal with the inherently more complex element cases
        else if ($domElement instanceof \DOMElement) {

            // Get the name
            $elementName = $domElement->nodeName;

            // Handle the Array case next
            if (strtolower($elementName) == "array" || (isset($this->tagClassMap[$elementName]) && strtolower($this->tagClassMap [$elementName]) == "array")) {

                $value = array();

                // Loop through each child.  If we encounter "Value" elements we find the first child of the value item and pass this off for
                // recursive processing, otherwise we pass the child node off for processing and add the result to the array to return
                $arrayElements = $domElement->childNodes;
                for ($i = 0; $i < $arrayElements->length; $i++) {
                    $arrayElement = $arrayElements->item($i);

                    if ($arrayElement instanceof \DOMElement) {

                        $key = $arrayElement->getAttribute("key");

                        // Convert the value into an object
                        $convertedValue = $this->convertDOM($arrayElement);

                        // Now set the array value either with a key or not depending on whether a key attribute is set.
                        if (isset ($key) && $key) {
                            $value [$key] = $convertedValue;
                        } else {
                            $value [] = $convertedValue;
                        }
                    }
                }

            } // Handle the case where a value node is passed.  This only occurs in the case where a lazy array is defined
            // With a single entry.  Here we simply evaluate and pass back the child entity
            else if (strtolower($elementName) == "value") {

                $valueElements = $domElement->childNodes;

                // Check for the count of child nodes to see whether we need to implicitly create an array wrapper
                if ($valueElements->length == 0) {
                    $value = "";
                } else if ($valueElements->length == 1) {
                    $value = $this->convertDOM($valueElements->item(0));
                } else {
                    $value = array();
                    for ($j = 0; $j < $valueElements->length; $j++) {
                        $currentItem = $valueElements->item($j);
                        if (!($currentItem instanceof \DOMText) && !($currentItem instanceof \DOMComment)) {
                            $key = $currentItem->getAttribute("key");
                            if (isset ($key) && $key) {
                                $value [$key] = $this->convertDOM($currentItem);
                            } else {
                                $value [] = $this->convertDOM($currentItem);
                            }
                        }
                    }
                    // If the result was only in fact a single item, reduce the array to a single value again.
                    if (sizeof($value) == 1) {
                        $value = $value [0];
                    }
                }

            } // Otherwise we must be in the object case
            else {

                // Array of property sets which pertain to set or get methods.  These
                // ensure that we write non accessor members first and prevent
                // ordering problems when we provide custom functionality to write to
                // properties in other get / set methods.
                $deferredPropertySets = array();

                // If a mapping has been defined for this element, use the mapping
                if (isset ($this->tagClassMap [$elementName])) {
                    $elementName = $this->tagClassMap [$elementName];
                }

                // Create the class

                if (strtolower($elementName) == "value") {
                    $value = $this->convertDOM($domElement->childNodes->item(0));
                } else {
                    $value = $this->loadObject($domElement, $elementName);
                }
            }

        }

        return $value;

    }