Method to render an xml element

@param   string  &$xmlElement   Name of the element
@param   string  $value         Value of the element
@param   string  $control_name  Name of the control
@return  array   Attributes of an element
181830
public function render(&$xmlElement, $value, $control_name = 'params')
	{
		$name  = (string) $xmlElement['name'];
		$label = (string) $xmlElement['label'];
		$descr = (string) $xmlElement['description'];

		//make sure we have a valid label
		$label = $label ? $label : $name;
		$result[0] = $this->fetchTooltip($label, $descr, $xmlElement, $control_name, $name);
		$result[1] = $this->fetchElement($name, $value, $xmlElement, $control_name);
		$result[2] = $descr;
		$result[3] = $label;
		$result[4] = $value;
		$result[5] = $name;

		return $result;
	}
494639
public function textarea(String $name = NULL, String $value = NULL, Array $_attributes = [])
    {
        $this->setNameAttribute($name);

        $this->setValueAttribute($value);

        if( ! empty($this->settings['attr']['name']) )
        {
            $this->_postback($this->settings['attr']['name'], $value);

            # 5.8.2.8[added]
            $this->getVMethodMessages();

            # 5.4.2[added]
            $this->_validate($this->settings['attr']['name'], $this->settings['attr']['name']);
            
            # 5.4.2[added]|5.4.5|5.4.6[edited]
            $value = $this->_getrow('textarea', $value, $this->settings['attr']);
        }

        $this->commonMethodsForInputElements('textarea');

        $this->getPermAttribute($perm);

        $this->createTextareaElementByValueAndAttributes($value, $_attributes, $return);

        $this->createBootstrapFormInputElementByType('textarea', $return, $_attributes, $return);

        $this->outputElement .= $this->_perm($perm, $return);

        return $this;
    }
857980
public function startValueElement($name, $value, $attributes = array())
    {
        $this->checkStartValueElement($name);

        $jsonValue = null;

        if (empty($attributes)) {
            $jsonValue = $value;
        } else {
            $jsonValue = new Json\JsonObject($this->json);
            foreach ($attributes as $attributeName => $attributeValue) {
                $jsonValue->{'_' . $attributeName} = $attributeValue;
            }
            $jsonValue->{'#text'} = $value;
        }

        if ($this->json instanceof Json\ArrayObject) {
            $this->json[] = $jsonValue;
        } else {
            $this->json->$name = $jsonValue;
        }
    }
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;
    }
237670
def element_for_attribute(name, namespace='')
      val = instance_values[name]
      return "" if val == nil
      "<%s:%s val='%s'/>" % [namespace, Axlsx::camel(name, false), val]
    end
36931
public void printXMLElement(String name, String[][] attributes)
    {
        Element element = new DefaultElement(name);

        if (attributes != null && attributes.length > 0) {
            for (String[] entry : attributes) {
                element.addAttribute(entry[0], entry[1]);
            }
        }

        try {
            this.xmlWriter.write(element);
        } catch (IOException e) {
            // TODO: add error log here
        }
    }
102251
def element(label = '&nbsp;', value = '', type = 'text_field', &block)
      value += @template.capture(&block) if block_given?
      %{
        <div class='control-group'>
          <label class='control-label'>#{label}</label>
          <div class='controls'>
            #{value}
          </div>
        </div>
      }.html_safe
    end
301469
public function xmlRenderer(array $response, string $firstelem, string $name = null): Renderer
    {
        $xmlElem = new \SimpleXMLElement("<?xml version=\"1.0\"  encoding=\"UTF-8\" ?><$firstelem></$firstelem>");
        $this->buildXml($response, $xmlElem);
        libxml_use_internal_errors(true);
        $feed = new \DOMDocument();
        $feed->preserveWhitespace = true;
        $result = dom_import_simplexml($xmlElem);
        if (!$result) {
            throw new Server500(new \ArrayObject(array("explain" => "Renderer: xml element is invalid.".
                ((isset(error_get_last()["message"])? " : ".error_get_last()["message"] : "" )), "solution" =>
                "Please send a valid xml element to renderer")));
        }

        $dom = dom_import_simplexml($xmlElem)->ownerDocument;
        $dom->formatOutput = true;
        $xml_file = $dom->saveXML();
        if ($xml_file) {
            $this->display_elements = array("xml" => $xml_file, "name" => $name);
        } else {
            throw new Server500(new \ArrayObject(array("explain" => "Renderer: xml element is invalid.", "solution" =>
                "Please send a valid xml element to renderer")));
        }
        return ($this);
    }
18622
function modify( &$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters ) {
        switch ($operatorName)
        {
            case 'washxml':
                $operatorValue = str_replace( array( '&', '"', "'", '<', '>' ), array( '&amp;', '&quot;', '&apos;', '&lt;', '&gt;' ), $operatorValue );
                break;
            case 'washxmlcomment':
                // in xml comments the -- string is not permitted
                $operatorValue = str_replace( '--', '_-', $operatorValue );
                break;
            case 'washxmlcdata':
                /// @todo
                eZDebug::writeWarning( 'Template operator washxmlcdata not yet implemented, it should not be used!', __METHOD__ );
                break;
            case 'xsdtype':
                $operatorValue = ggWSDLParser::phpType2xsdType( $operatorValue, $namedParameters['targetprefix'], $namedParameters['xsdprefix'], $namedParameters['soapencprefix'] );
                break;
            case 'classInspect':
                $operatorValue = ggeZWebservices::classInspect( $operatorValue );
                break;
        }
    }
917636
public static function xmlStrToArray($xmlString, $tagName = false, $elementCount = false)
    {
        $doc = new DOMDocument();
        try {
            $doc->loadXML($xmlString);
        } catch (Exception $exc) {
            return [];
        }
        $result = [];

        if (is_string($tagName)) {
            $nodes = $doc->documentElement->getElementsByTagName($tagName);
            if (false == $elementCount) {
                $elementCount = $nodes->length;
            }
            for ($i = 0; $i < $elementCount; $i++) {
                $result[] = self::domNodeToArray($nodes->item($i));
            }
        } else {
            $result = self::domNodeToArray($doc->documentElement);
        }

        return $result;
    }
1093411
protected function renderAttribute($name, $value = null)
    {
        if ($value === null) {
            return $name;
        }

        if (is_array($value)) {
            $value = implode(' ', $value);
        }

        return vsprintf('%s="%s"', [
            $name,
            Html::escape((string) $value),
        ]);
    }
1296558
public static function urlFieldControlGroup($name, $value = '', $htmlOptions = array())
    {
        return self::controlGroup(self::INPUT_TYPE_URL, $name, $value, $htmlOptions);
    }
87665
public static function addAttribute(\DOMNode $rootNode, $name, $value)
    {
        XmlUtil::checkIfPrefixWasDefined($rootNode, $name);

        $owner = XmlUtil::getOwnerDocument($rootNode);
        $attrNode = $owner->createAttribute($name);
        $attrNode->value = $value;
        $rootNode->setAttributeNode($attrNode);
        return $rootNode;
    }
1091156
public static function textAreaControlGroup($name, $value = '', $htmlOptions = array())
    {
        return self::controlGroup(self::INPUT_TYPE_TEXTAREA, $name, $value, $htmlOptions);
    }
317605
private function encodeValue(XMLWriter $xml, $value) {

        if ( $value === null ) $xml->writeRaw($this->use_ex_nil === true ? '<ex:nil />' : '<nil />');

        else if ( is_array($value) ) {

            if ( !self::catchStruct($value) ) $this->encodeArray($xml, $value);

            else $this->encodeStruct($xml, $value);

        } else if ( @array_key_exists($value, $this->special_types) ) {

            switch ( $this->special_types[$value] ) {

                case 'base64':
                    
                    $xml->writeElement("base64", $value);

                    break;
                
                case 'datetime':
                    
                    $xml->writeElement("dateTime.iso8601", self::timestampToIso8601Time($value));

                    break;
                
                case 'cdata':
                    
                    $xml->writeCData($value);

                    break;
                
            }

        } else if ( is_bool($value) ) {

            $xml->writeElement("boolean", $value ? 1 : 0);

        } else if ( is_double($value) ) {

            $xml->writeElement("double", $value);

        } else if ( is_integer($value) ) {
            
            $xml->writeElement("int", $value);

        } else if ( is_object($value) ) {

            $this->encodeObject($xml, $value);

        } else if ( is_string($value) ) {

            $value = htmlentities($value, ENT_QUOTES, $this->encoding, false);

            $string = preg_replace_callback('/&([a-zA-Z][a-zA-Z0-9]+);/S', 'self::numericEntities', $value);

            $xml->writeRaw("<string>".$string."</string>");

        } else throw new XmlrpcException("Unknown type for encoding");

    }
805819
private function convertElement(DOMElement $element, $value)
    {
        $sequential = $this->isArrayAllKeySequential($value);

        if (! is_array($value)) {
            $value = htmlspecialchars($value);

            $value = $this->removeControlCharacters($value);

            $element->nodeValue = $value;

            return;
        }

        foreach ($value as $key => $data) {
            if (! $sequential) {
                if (($key === '_attributes') || ($key === '@attributes')) {
                    $this->addAttributes($element, $data);
                } elseif ((($key === '_value') || ($key === '@value')) && is_string($data)) {
                    $element->nodeValue = htmlspecialchars($data);
                } elseif ((($key === '_cdata') || ($key === '@cdata')) && is_string($data)) {
                    $element->appendChild($this->document->createCDATASection($data));
                } elseif ((($key === '_mixed') || ($key === '@mixed')) && is_string($data)) {
                    $fragment = $this->document->createDocumentFragment();
                    $fragment->appendXML($data);
                    $element->appendChild($fragment);
                } else {
                    $this->addNode($element, $key, $data);
                }
            } elseif (is_array($data)) {
                $this->addCollectionNode($element, $data);
            } else {
                $this->addSequentialNode($element, $data);
            }
        }
    }
175589
protected function renderControl(ElementInterface $element, $elementString, $id, $controlWrapper = null)
    {
        $description = $this->getDescriptionHelper()->render($element);
        $label       = $this->renderLabel($element);
        $control     = $this->renderControlWrapper($id, $element, $elementString, $description, $controlWrapper);
        if ($label) {
            switch ($this->labelPosition) {
                case self::LABEL_PREPEND:
                    return $label . $control;
                case self::LABEL_APPEND:
                default:
                    return $control . $label;
            }
        }
        return $control;
    }