Sets the accurate $item property according to the DomElement content

@param  NodeInterface $node
@param  \DOMElement   $element
778876
public function setProperty(NodeInterface $node, \DOMElement $element) : void
    {
        if ($node instanceof ItemInterface) {
            $author = $node->newAuthor();
            $author->setName($element->nodeValue);
            $node->setAuthor($author);
        }
    }
248812
public static function setDOMElementValue(DOMElement $element, $value)
    {
        switch (gettype($value)) {
            case 'boolean':
                $element->nodeValue = ($value === true) ? 'true' : 'false';
            break;

            default:
                $element->nodeValue = $value;
            break;
        }
    }
289199
protected function mapElementToModelData(ElementInterface $child)
    {
        $this->setModelValueFromElement($child);
        
        $children = $child->getChildren();
        if ($children->count()) {
            $this->mapElementCollectionToModelData($children);
        }
    }
1005614
protected function addRules(DOMElement $node, Tag $tag)
	{
		foreach ($this->xpath->query('rules/*', $node) as $ruleNode)
		{
			$methodName = $ruleNode->nodeName;
			$args       = [];
			if ($ruleNode->textContent)
			{
				$args[] = $ruleNode->textContent;
			}

			call_user_func_array([$tag->rules, $methodName], $args);
		}
	}
427385
public function validateNode(NodeInterface $node): Asserts
    {
        return $this->validate(XmlNodeUtils::nodeToXmlString($node), $node);
    }
179080
public function removeItem(ItemInterface $item)
    {
        $item->setGrid(null);
        $this->items->removeElement($item);
    }
360088
protected function initializeNode(\DOMElement $node)
    {
        if (!isset($node->tagName)) {
            return;
        }

        $readability = $this->dom->createAttribute('readability');
        // this is our contentScore
        $readability->value = 0;
        $node->setAttributeNode($readability);

        // using strtoupper just in case
        switch (strtoupper($node->tagName)) {
            case 'ARTICLE':
                $readability->value += 15;
                // no break
            case 'DIV':
                $readability->value += 5;
                break;
            case 'PRE':
            case 'CODE':
            case 'TD':
            case 'BLOCKQUOTE':
            case 'FIGURE':
                $readability->value += 3;
                break;
            case 'SECTION':
                // often misused
                // $readability->value += 2;
                break;
            case 'OL':
            case 'UL':
            case 'DL':
            case 'DD':
            case 'DT':
            case 'LI':
                $readability->value -= 2 * round($this->getLinkDensity($node), 0, PHP_ROUND_HALF_UP);
                break;
            case 'ASIDE':
            case 'FOOTER':
            case 'HEADER':
            case 'ADDRESS':
            case 'FORM':
            case 'BUTTON':
            case 'TEXTAREA':
            case 'INPUT':
            case 'NAV':
                $readability->value -= 3;
                break;
            case 'H1':
            case 'H2':
            case 'H3':
            case 'H4':
            case 'H5':
            case 'H6':
            case 'TH':
            case 'HGROUP':
                $readability->value -= 5;
                break;
        }

        $readability->value += $this->getWeight($node);
    }
286482
private static function convertNode(XMLElement $element, DOMNode $node)
    {
        if ($node->hasAttributes()) {
            foreach ($node->attributes as $name => $attrEl) {
                $element->setAttribute($name, General::sanitize($attrEl->value));
            }
        }

        if ($node->hasChildNodes()) {
            foreach ($node->childNodes as $childNode) {
                if ($childNode instanceof DOMCdataSection) {
                    $element->setValue(General::wrapInCDATA($childNode->data));
                } elseif ($childNode instanceof DOMText) {
                    if ($childNode->isWhitespaceInElementContent() === false) {
                        $element->setValue(General::sanitize($childNode->data));
                    }
                } elseif ($childNode instanceof DOMElement) {
                    self::convert($element, $childNode);
                }
            }
        }
    }
607319
public function setDOMElementPayload(DOMElement $element)
    {
        $this->setPayload($element->ownerDocument->saveXML($element));

        return $this;
    }
471282
protected function reparentElement(DOMElement $element)
	{
		$parentNode = $element->parentNode;
		do
		{
			$lastChild = $parentNode->lastChild;
			$parentNode->parentNode->insertBefore($lastChild, $parentNode->nextSibling);
		}
		while (!$lastChild->isSameNode($element));
	}
968417
public static function setDOMElementAttribute(DOMElement $element, $attribute, $value)
    {
        switch (gettype($value)) {
            case 'boolean':
                $element->setAttribute($attribute, ($value === true) ? 'true' : 'false');
                break;
            
            default:
                $element->setAttribute($attribute, '' . $value);
                break;
        }
    }
558552
public static void setDocumentElement(final Document document, final Element element) {
        Element documentElement = document.getDocumentElement();
        if (documentElement != null) {
            document.removeChild(documentElement);
        }
        if (element != null) {
            if (element.getOwnerDocument().equals(document)) {
                document.appendChild(element);
                return;
            }
            Node node = document.adoptNode(element);
            document.appendChild(node);
        }
    }
833540
public function addNode(NodeInterface $node)
    {
        if ($this->checkChildNode($node)) {
            $this->nodes->add($node);

            $node->setPosition(count($this->getNodes()));
            $node->setParent($this);
        }

        return $this;
    }
552616
protected function init(DOMElement $element)
    {
        $this->parseType($element);
        $this->parseId($element, false);
        $this->parseName($element, false);

        $this->parseArgs($element);
    }
359279
protected function processItemReferenceElements(
        array $itemrefElements,
        ContextInterface $context,
        ThingInterface $thing
    ) {
        $iterator = new DOMIterator(
            $itemrefElements,
            $context->setParentThing($thing),
            new MicrodataElementProcessor()
        );

        // Iterate through all $node
        foreach ($iterator->getRecursiveIterator() as $node) {
            $node || true;
        }
    }
42209
public function add(Node\NodeInterface $node)
	{
		$node->setRepository($this);
		parent::add($node);
		$this->array[] = $node;
	}
1034335
public function setElementBy($element, $value, $nodeValue)
    {
        $xql = "//*[@$element='$value']";

        if (is_object($nodeValue)) {
            $result = $this->query($xql)->item(0)->appendChild($this->importNode($nodeValue, true));
        } else {
            $result = $this->query($xql)->item(0)->nodeValue = $nodeValue;
        }

        return $result;
    }