Get the html node for this element

@param \DOMElement $node
@param \AppShed\Remote\XML\DOMDocument $xml
@param \AppShed\Remote\HTML\Settings $settings
497040
protected function getHTMLNodeInner($node, $xml, $settings)
    {
        $node->setAttribute('data-capturetype', $this->type);
        $node->setAttribute('data-name', $this->variableName);
        $node->setAttribute('data-save-value', $this->save);

        $node->appendChild($on = $xml->createElement('div', 'on'));

        $on->appendChild($xml->createElement('div', 'image'));
        $on->appendChild($xml->createElement('div', ['class' => 'title', 'text' => $this->title]));
        $on->appendChild($xml->createElement('div', ['class' => 'text', 'text' => $this->subtitle]));

        $on->appendChild($xml->createElement('button', ['class' => 'capture', 'text' => 'Capture']));
        $on->appendChild($xml->createElement('button', ['class' => 'choose', 'text' => 'Choose']));

        $node->appendChild($off = $xml->createElement('div', 'off'));

        $off->appendChild(
            $xml->createElement('div', ['class' => 'title', 'text' => ucfirst($this->type) . ' Capture'])
        );
        $off->appendChild(
            $xml->createElement(
                'div',
                [
                    'class' => 'text',
                    'text' => "You need to install this app via the store to use {$this->type} capture"
                ]
            )
        );
    }
1295199
private function parseXml(\DOMNode $node, array $context = [])
    {
        $data = $this->parseXmlAttributes($node, $context);

        $value = $this->parseXmlValue($node, $context);

        if (!\count($data)) {
            return $value;
        }

        if (!\is_array($value)) {
            $data['#'] = $value;

            return $data;
        }

        if (1 === \count($value) && key($value)) {
            $data[key($value)] = current($value);

            return $data;
        }

        foreach ($value as $key => $val) {
            $data[$key] = $val;
        }

        return $data;
    }
142943
public function addNode($NodeID, array $Settings = [])
    {
        /* if the node already exists, ignore */
        if (isset($this->Data[$NodeID])) {
            return 0;
        }

        $Name = isset($Settings["Name"]) ? $Settings["Name"] : "Node " . $NodeID;
        $Connections = isset($Settings["Connections"]) ? $Settings["Connections"] : null;

        $R = isset($Settings["R"]) ? $Settings["R"] : $this->Default["R"];
        $G = isset($Settings["G"]) ? $Settings["G"] : $this->Default["G"];
        $B = isset($Settings["B"]) ? $Settings["B"] : $this->Default["B"];
        $Alpha = isset($Settings["Alpha"]) ? $Settings["Alpha"] : $this->Default["Alpha"];
        $BorderR = isset($Settings["BorderR"]) ? $Settings["BorderR"] : $this->Default["BorderR"];
        $BorderG = isset($Settings["BorderG"]) ? $Settings["BorderG"] : $this->Default["BorderG"];
        $BorderB = isset($Settings["BorderB"]) ? $Settings["BorderB"] : $this->Default["BorderB"];
        $BorderAlpha = isset($Settings["BorderAlpha"]) ? $Settings["BorderAlpha"] : $this->Default["BorderAlpha"];
        $Surrounding = isset($Settings["Surrounding"]) ? $Settings["Surrounding"] : $this->Default["Surrounding"];
        $BackgroundR = isset($Settings["BackgroundR"]) ? $Settings["BackgroundR"] : $this->Default["BackgroundR"];
        $BackgroundG = isset($Settings["BackgroundG"]) ? $Settings["BackgroundG"] : $this->Default["BackgroundG"];
        $BackgroundB = isset($Settings["BackgroundB"]) ? $Settings["BackgroundB"] : $this->Default["BackgroundB"];
        $BackgroundAlpha = isset($Settings["BackgroundAlpha"])
            ? $Settings["BackgroundAlpha"] : $this->Default["BackgroundAlpha"]
        ;
        $Force = isset($Settings["Force"]) ? $Settings["Force"] : $this->Default["Force"];
        $NodeType = isset($Settings["NodeType"]) ? $Settings["NodeType"] : $this->Default["NodeType"];
        $Size = isset($Settings["Size"]) ? $Settings["Size"] : $this->Default["Size"];
        $Shape = isset($Settings["Shape"]) ? $Settings["Shape"] : $this->Default["Shape"];
        $FreeZone = isset($Settings["FreeZone"]) ? $Settings["FreeZone"] : $this->Default["FreeZone"];

        if ($Surrounding != null) {
            $BorderR = $R + $Surrounding;
            $BorderG = $G + $Surrounding;
            $BorderB = $B + $Surrounding;
        }

        $this->Data[$NodeID]["R"] = $R;
        $this->Data[$NodeID]["G"] = $G;
        $this->Data[$NodeID]["B"] = $B;
        $this->Data[$NodeID]["Alpha"] = $Alpha;
        $this->Data[$NodeID]["BorderR"] = $BorderR;
        $this->Data[$NodeID]["BorderG"] = $BorderG;
        $this->Data[$NodeID]["BorderB"] = $BorderB;
        $this->Data[$NodeID]["BorderAlpha"] = $BorderAlpha;
        $this->Data[$NodeID]["BackgroundR"] = $BackgroundR;
        $this->Data[$NodeID]["BackgroundG"] = $BackgroundG;
        $this->Data[$NodeID]["BackgroundB"] = $BackgroundB;
        $this->Data[$NodeID]["BackgroundAlpha"] = $BackgroundAlpha;
        $this->Data[$NodeID]["Name"] = $Name;
        $this->Data[$NodeID]["Force"] = $Force;
        $this->Data[$NodeID]["Type"] = $NodeType;
        $this->Data[$NodeID]["Size"] = $Size;
        $this->Data[$NodeID]["Shape"] = $Shape;
        $this->Data[$NodeID]["FreeZone"] = $FreeZone;
        if ($Connections != null) {
            if (is_array($Connections)) {
                foreach ($Connections as $Key => $Value) {
                    $this->Data[$NodeID]["Connections"][] = $Value;
                }
            } else {
                $this->Data[$NodeID]["Connections"][] = $Connections;
            }
        }
    }
1269653
public function node(\DOMNode $node) {
        // A listing of types is at http://php.net/manual/en/dom.constants.php
        switch ($node->nodeType) {
            case XML_ELEMENT_NODE:
                $this->rules->element($node);
                break;
            case XML_TEXT_NODE:
                $this->rules->text($node);
                break;
            case XML_CDATA_SECTION_NODE:
                $this->rules->cdata($node);
                break;
            // FIXME: It appears that the parser doesn't do PI's.
            case XML_PI_NODE:
                $this->rules->processorInstruction($node);
                break;
            case XML_COMMENT_NODE:
                $this->rules->comment($node);
                break;
            // Currently we don't support embedding DTDs.
            default:
                print '<!-- Skipped -->';
                break;
        }
    }
316742
function(node, settings) {
      var prefix = settings('prefix') || '',
          circle = document.createElementNS(settings('xmlns'), 'circle');

      // Defining the node's circle
      circle.setAttributeNS(null, 'data-node-id', node.id);
      circle.setAttributeNS(null, 'class', settings('classPrefix') + '-node');
      circle.setAttributeNS(
        null, 'fill', node.color || settings('defaultNodeColor'));

      // Returning the DOM Element
      return circle;
    }
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);
    }
269443
protected function getHTMLNodeInner($node, $xml, $settings)
    {
        if ($this->image) {
            $imageDiv = $xml->createElement('div', ['class' => 'image-container']);
            $node->appendChild($imageDiv);
            $imageDiv->appendChild($xml->createImgElement($this->image->getUrl(), 'image', $this->image->getSize()));
        }
        parent::getHTMLNodeInner($node, $xml, $settings);
    }
564920
public static function getText(DOMElement $node)
    {
        $s = '';
        for ($i = 0; $i < $node->childNodes->length; $i++) {
            $child = $node->childNodes->item($i);

            switch ($child->nodeType) {
                case XML_CDATA_SECTION_NODE:
                case XML_TEXT_NODE: {
                    $s .= $child->nodeValue;
                }
            }
        }

        return $s;
    }
25280
protected function getNodeValuesByTagName(DOMElement $node, $tagName)
    {
        $values = array();
        $results = $node->getElementsByTagName($tagName);
        if ($results->length) {
            foreach ($results as $result) {
                if ($result->nodeValue) {
                    $values[] = $result->nodeValue;
                }
            }
        }

        return $values;
    }
1200012
protected function getHTMLNodeInner($node, $xml, $settings)
    {
        if ($this->image) {
            $node->appendChild($xml->createImgElement($this->image->getUrl(), 'icon', $this->image->getSize()));
        }
        $node->appendChild($xml->createElement('div', ['class' => 'text', 'text' => $this->title]));
        $this->applyLinkToNode($xml, $node, $settings);
    }
862866
protected function apply_internal( \DOMText $textnode, Settings $settings, $is_title = false ) {
		if ( empty( $settings[ $this->settings_switch ] ) ) {
			return;
		}

		$textnode->data = \preg_replace( $this->regex, RE::escape_tags( "<span class=\"{$this->css_class}\">\$1</span>" ), $textnode->data );
	}
238436
public function getMarkerObject($xml, $settings)
    {
        return [
            'title' => $this->title,
            'subtitle' => $this->subtitle,
            'latitude' => $this->latitude,
            'longitude' => $this->longitude,
            'html' => $xml->saveXML($this->getHTMLNode($xml, $settings))
        ];
    }
373134
public function apply( \DOMText $textnode, Settings $settings, $is_title = false ) {
		if ( ! DOM::has_class( $textnode, $this->classes_to_avoid ) ) {
			$this->apply_internal( $textnode, $settings, $is_title );
		}
	}
940788
protected function getStyle(DOMElement $node, $deep = false)
	{
		$style = '';
		if (ElementInspector::preservesWhitespace($node))
		{
			$style .= 'white-space:pre;';
		}
		$style .= $node->getAttribute('style');

		// Add the content of any descendant/child xsl:attribute named "style"
		$query = (($deep) ? './/' : './') . 'xsl:attribute[@name="style"]';
		foreach ($this->xpath->query($query, $node) as $attribute)
		{
			$style .= ';' . $attribute->textContent;
		}

		return $style;
	}
1345820
public function getTypeForDOMNode( $node )
	{
		$ns = $node->namespaceURI;
		if ( ! $ns )
		{
			if ( $node instanceof \DOMElement )
			{
				// Get the default namespace for the DOMNode
				$doc = $node->ownerDocument;
				/**
				 * @var DOMNode $firstChild
				 */
				$firstChild = $doc->documentElement;
				$ns = $firstChild->getAttributeNode('xmlns')
					? $firstChild->getAttributeNode('xmlns')->nodeValue
					: "";
			}
			else if ( $node instanceof \DOMAttr )
			{
				$parent = $node->parentNode;
				if ( $parent )
				{
					$ns = $parent->namespaceURI;
				}
			}
		}

		$prefix = $this->getPrefixForNamespace( $ns );
		$types;

		if ( is_a( $node, "DOMElement" ) )
		{
			$el = $this->getElement( $node->localName, $prefix );
			if ( $el === false ) throw new SchemaException( "Unable to locate element '{$node->localName}' in the schema types" );
			$types = isset( $el['types'] ) ? $el['types'] : array();
		}
		else if ( is_a( $node, "DOMAttr" ) )
		{
			$attr = $this->getAttribute( $node->localName, $prefix );
			if ( $attr === false ) throw new SchemaException( "Unable to locate attribute '{$node->localName}' in the schema types" );
			$types = isset( $attr['types'] ) ? $attr['types'] : array();
		}
		else if ( is_a( $node, "DOMDocument" ) )
		{
			throw new SchemaException("Getting the type for a Document node is not supported");
		}
		else if ( is_a( $node, "DOMComment" ) )
		{
			// BMS 2018-04-09 Test candidates changed.
			return "xs:string";
		}
		else if ( is_a( $node, "DOMProcessingInstruction" ) )
		{
			throw new SchemaException("Getting the type for a Processing Instruction node is not supported");
		}
		else if ( is_a( $node, "DOMText" ) )
		{
			// BMS 2018-04-09 Test candidates changed.
			return "xs:string";
		}
		else if ( is_a( $node, "DOMNameSpaceNode" ) )
		{
			throw new SchemaException("Getting the type for a Namespace node is not supported");
		}

		// Get the first simple type
		$type = null;
		foreach ( $types as $xmlType )
		{
			if ( is_array( $xmlType ) )
			{
				if ( isset( $xmlType['class'] ) && $xmlType['class'] == "complex" )
				{
					continue;
				}

				if ( isset( $xmlType['contentType'] ) && $xmlType['contentType'] == "extension" && isset( $xmlType['base'] ) )
				{
					return $xmlType['parent'];
				}

				if ( isset( $xmlType['contentType'] ) && $xmlType['contentType'] == "restriction" && isset( $xmlType['base'] ) )
				{
					return $xmlType['parent'];
				}
			}

			return $xmlType;
		}

		return false;
	}
303758
public function apply( \DOMText $textnode, Settings $settings, $is_title = false ) {
		// Intervening inline tags may interfere with widow identification, but that is a sacrifice of using the parser.
		// Intervening tags will only interfere if they separate the widow from previous or preceding whitespace.
		if ( empty( $settings['dewidow'] ) || empty( $settings['dewidowMaxPull'] ) || empty( $settings['dewidowMaxLength'] ) ) {
			return;
		}

		if ( '' === DOM::get_next_chr( $textnode ) ) {
			// We have the last type "text" child of a block level element.
			$textnode->data = $this->dewidow( $textnode->data, Strings::functions( $textnode->data ), $settings['dewidowMaxPull'], $settings['dewidowMaxLength'], $settings['dewidowWordNumber'], $settings->no_break_narrow_space() );
		}
	}
119748
public function getHTMLNode($xml, $settings)
    {
        if (!$this->node) {
            $this->node = $xml->createElement(static::HTML_TAG, $this->getClass());
            $this->node->setAttribute('id', $this->getIdType() . $settings->getPrefix() . $this->getId());
            if (!$this->editable) {
                $this->node->setAttribute('data-editable', 'false');
            }
            $this->getHTMLNodeInner($this->node, $xml, $settings);
        }
        return $this->node;
    }