/*! return self as XML string, starting part
552726
function to_xml_start(){
		if ($this->skip) return "";
		
		return "<option ".($this->selected?"selected='true' ":"")."value='".$this->xmlentities($this->get_id())."'><![CDATA[".$this->data[$this->config->text[0]["name"]]."]]>";
	}
1031744
function inputTdXML( &$tdNode, $currentSectionLevel, $tdSectionLevel = null )
    {
        $output = '';
        $tagName = $tdNode instanceof DOMNode ? $tdNode->nodeName : '';

        switch ( $tagName )
        {
            case 'paragraph' :
            {
                $output .= $this->inputParagraphXML( $tdNode, $currentSectionLevel, $tdSectionLevel  );
            }break;

            case 'section' :
            {
                $tdSectionLevel += 1;
                $output .= $this->inputSectionXML( $tdNode, $currentSectionLevel, $tdSectionLevel );
            }break;

            default :
            {
                eZDebug::writeError( "Unsupported tag at this level: $tagName", __METHOD__ );
            }break;
        }
        return $output;
    }
226922
function xmlString()
    {
        $doc = new DOMDocument( '1.0', 'utf-8' );
        $root = $doc->createElement( "ezmultioption2" );
        $doc->appendChild( $root );


        $this->createDomElementForGroup( $doc, $root );

        $rulesNode = $doc->createElement( "rules" );

        foreach ( $this->Rules as $ruleFor => $rule )
        {
            unset( $ruleNode );
            $ruleNode = $doc->createElement( "rule" );
            $ruleNode->setAttribute( "option_id", $ruleFor );
            foreach ( $rule as $multioptionID => $ruleData )
            {
                unset( $ruleDataNode );
                $ruleDataNode = $doc->createElement( "rule_data" );
                $ruleDataNode->setAttribute( "multioption_id", $multioptionID );
                foreach ( $ruleData as $optionID )
                {
                    unset( $includeNode );
                    $includeNode = $doc->createElement( "option_id", $optionID );
                    $ruleDataNode->appendChild( $includeNode );
                }
                $ruleNode->appendChild( $ruleDataNode );
            }
            $rulesNode->appendChild( $ruleNode );
        }
        $root->appendChild( $rulesNode );

        $xml = $doc->saveXML();
        return $xml;
    }
639869
public function buildXML()
    {
        $xml = new EncodingRequest();

        $request = $xml->setDomQuery($this->client->getConfig('userid'), $this->client->getConfig('userkey'), $this->getName());

        foreach ($this->getOperation()->getParams() as $name => $arg) {

            if ($this->get($name) === true) {
                $request->appendChild($xml->createElement($name));
            } else {
                if (! is_null($this->get($name)) && $this->get($name) !== false) {

                    if (! is_array($this->get($name))) {
                        // Non Array Type - String, Integer, etc ..

                        $request->appendChild($xml->createElement($name, $this->get($name)));
                    } else {

                        if ($name == "source") {
                            // Build "Flat" Array to XML

                            foreach ($this->get($name) as $key => $value) {
                                $request->appendChild($xml->createElement($name, $value));
                            }
                        } else {
                            // Build Array to XML

                            $arrayRoot = $request->appendChild($xml->createElement($name));

                            foreach ($this->get($name) as $key => $value) {

                                if (! is_array($value)) {
                                    $arrayRoot->appendChild($xml->createElement($key, $value));
                                } else {
                                    if ($key == "destination") {
                                        // Build "Flat" Array to XML in a sub Element
                                        foreach ($value as $subValue) {
                                            $arrayRoot->appendChild($xml->createElement($key, $subValue));
                                        }
                                    } else {
                                        $arraySubRoot = $arrayRoot->appendChild($xml->createElement($key));

                                        foreach ($value as $subKey => $subValue) {
                                            $arraySubRoot->appendChild($xml->createElement($subKey, $subValue));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

        return $xml;
    }
330712
function inputTagXML( &$tag, $currentSectionLevel, $tdSectionLevel = null )
    {
        $output       = '';
        $tagName      = $tag instanceof DOMNode ? $tag->nodeName : '';
        $childTagText = '';

        // render children tags
        if ( $tag->hasChildNodes() )
        {
            $tagChildren = $tag->childNodes;
            foreach ( $tagChildren as $childTag )
            {
                $childTagText .= $this->inputTagXML( $childTag, $currentSectionLevel, $tdSectionLevel );
            }
        }
        switch ( $tagName )
        {
            case '#text' :
            {
                $tagContent = $tag->textContent;
                if ( !strlen( $tagContent ) )
                {
                    break;
                }

                $tagContent = htmlspecialchars( $tagContent );
                $tagContent = str_replace ( '&amp;nbsp;', '&nbsp;', $tagContent );

                if ( $this->allowMultipleSpaces )
                {
                    $tagContent = str_replace( '  ', ' &nbsp;', $tagContent );
                }
                else
                {
                    $tagContent = preg_replace( "/ {2,}/", ' ', $tagContent );
                }

                if ( $tagContent[0] === ' ' && !$tag->previousSibling )//- Fixed "first space in paragraph" issue (ezdhtml rev.12246)
                {
                    $tagContent[0] = ';';
                    $tagContent = '&nbsp' . $tagContent;
                }

                if ( $this->allowNumericEntities )
                    $tagContent = preg_replace( '/&amp;#([0-9]+);/', '&#\1;', $tagContent );

                $output .= $tagContent;

            }break;

            case 'embed' :
            case 'embed-inline' :
            {
                $view      = $tag->getAttribute( 'view' );
                $size      = $tag->getAttribute( 'size' );
                $alignment = $tag->getAttribute( 'align' );
                $objectID  = $tag->getAttribute( 'object_id' );
                $nodeID    = $tag->getAttribute( 'node_id' );
                $showPath  = $tag->getAttribute( 'show_path' );
                $htmlID    = $tag->getAttributeNS( 'http://ez.no/namespaces/ezpublish3/xhtml/', 'id' );
                $className = $tag->getAttribute( 'class' );
                $idString  = '';
                $tplSuffix = '';

                if ( !$size )
                {
                    $contentIni = eZINI::instance( 'content.ini' );
                    $size       = $contentIni->variable( 'ImageSettings', 'DefaultEmbedAlias' );
                }

                if ( !$view )
                {
                    $view = $tagName;
                }

                $objectAttr = '';
                $objectAttr .= ' alt="' . $size . '"';
                $objectAttr .= ' view="' . $view . '"';

                if ( $htmlID != '' )
                {
                    $objectAttr .= ' html_id="' . $htmlID . '"';
                }
                if ( $showPath === 'true' )
                {
                    $objectAttr .= ' show_path="true"';
                }

                if ( $tagName === 'embed-inline' )
                    $objectAttr .= ' inline="true"';
                else
                    $objectAttr .= ' inline="false"';

                $customAttributePart = self::getCustomAttrPart( $tag, $styleString );
                $object              = false;

                if ( is_numeric( $objectID ) )
                {
                    $object = eZContentObject::fetch( $objectID );
                    $idString = 'eZObject_' . $objectID;
                }
                elseif ( is_numeric( $nodeID ) )
                {
                    $node      = eZContentObjectTreeNode::fetch( $nodeID );
                    $object    = $node instanceof eZContentObjectTreeNode ? $node->object() : false;
                    $idString  = 'eZNode_' . $nodeID;
                    $tplSuffix = '_node';
                }

                if ( $object instanceof eZContentObject )
                {
                    $objectName = $object->attribute( 'name' );
                    $classIdentifier = $object->attribute( 'class_identifier' );
                    if ( !$object->attribute( 'can_read' ) ||
                         !$object->attribute( 'can_view_embed' ) )
                    {
                        $tplSuffix = '_denied';
                    }
                    else if ( $object->attribute( 'status' ) == eZContentObject::STATUS_ARCHIVED )
                    {
                        $className .= ' ezoeItemObjectInTrash';
                        if ( self::$showEmbedValidationErrors )
                        {
                            $oeini = eZINI::instance( 'ezoe.ini' );
                            if ( $oeini->variable('EditorSettings', 'ValidateEmbedObjects' ) === 'enabled' )
                                $className .= ' ezoeItemValidationError';
                        }
                    }
                }
                else
                {
                    $objectName = 'Unknown';
                    $classIdentifier = false;
                    $tplSuffix = '_deleted';
                    $className .= ' ezoeItemObjectDeleted';
                    if ( self::$showEmbedValidationErrors )
                    {
                        $className .= ' ezoeItemValidationError';
                    }
                }

                $embedContentType = self::embedTagContentType( $classIdentifier );
                if ( $embedContentType === 'images' )
                {
                    $ini = eZINI::instance();
                    $URL = self::getServerURL();
                    $objectAttributes = $object->contentObjectAttributes();
                    $imageDatatypeArray = $ini->variable('ImageDataTypeSettings', 'AvailableImageDataTypes');
                    $imageWidth = 32;
                    $imageHeight = 32;
                    foreach ( $objectAttributes as $objectAttribute )
                    {
                        $classAttribute = $objectAttribute->contentClassAttribute();
                        $dataTypeString = $classAttribute->attribute( 'data_type_string' );
                        if ( in_array ( $dataTypeString, $imageDatatypeArray ) && $objectAttribute->hasContent() )
                        {
                            $content = $objectAttribute->content();
                            if ( $content == null )
                                continue;

                            if ( $content->hasAttribute( $size ) )
                            {
                                $imageAlias  = $content->imageAlias( $size );
                                $srcString   = $URL . '/' . $imageAlias['url'];
                                $imageWidth  = $imageAlias['width'];
                                $imageHeight = $imageAlias['height'];
                                break;
                            }
                            else
                            {
                                eZDebug::writeError( "Image alias does not exist: $size, missing from image.ini?",
                                    __METHOD__ );
                            }
                        }
                    }

                    if ( !isset( $srcString ) )
                    {
                        $srcString = self::getDesignFile('images/tango/mail-attachment32.png');
                    }

                    if ( $alignment === 'center' )
                    {
                        $objectAttr .= ' align="middle"';
                        $className .= ' ezoeAlignmiddle'; // align="middle" is not taken into account by browsers on img
                    }
                    else if ( $alignment )
                        $objectAttr .= ' align="' . $alignment . '"';

                    if ( $className != '' )
                        $objectAttr .= ' class="' . $className . '"';

                    $output .= '<img id="' . $idString . '" title="' . $objectName . '" src="' .
                               htmlspecialchars( $srcString ) . '" width="' . $imageWidth . '" height="' . $imageHeight .
                               '" ' . $objectAttr . $customAttributePart . $styleString . ' />';
                }
                else if ( self::embedTagIsCompatibilityMode() )
                {
                    $srcString = self::getDesignFile('images/tango/mail-attachment32.png');
                    if ( $alignment === 'center' )
                        $objectAttr .= ' align="middle"';
                    else if ( $alignment )
                        $objectAttr .= ' align="' . $alignment . '"';

                    if ( $className != '' )
                        $objectAttr .= ' class="' . $className . '"';

                    $output .= '<img id="' . $idString . '" title="' . $objectName . '" src="' .
                               $srcString . '" width="32" height="32" ' . $objectAttr .
                               $customAttributePart . $styleString . ' />';
                }
                else
                {
                    if ( $alignment )
                        $objectAttr .= ' align="' . $alignment . '"';

                    if ( $className )
                        $objectAttr .= ' class="ezoeItemNonEditable ' . $className . ' ezoeItemContentType' .
                                       ucfirst( $embedContentType ) . '"';
                    else
                        $objectAttr .= ' class="ezoeItemNonEditable ezoeItemContentType' .
                                       ucfirst( $embedContentType ) . '"';

                    if ( $tagName === 'embed-inline' )
                        $htmlTagName = 'span';
                    else
                        $htmlTagName = 'div';

                    $objectParam = array( 'size' => $size, 'align' => $alignment, 'show_path' => $showPath );
                    if ( $htmlID ) $objectParam['id'] = $htmlID;

                    $res = eZTemplateDesignResource::instance();
                    $res->setKeys( array( array('classification', $className) ) );

                    if ( isset( $node ) )
                    {
                        $templateOutput = self::fetchTemplate( 'design:content/datatype/view/ezxmltags/' . $tagName . $tplSuffix . '.tpl', array(
                            'view' => $view,
                            'object' => $object,
                            'link_parameters' => array(),
                            'classification' => $className,
                            'object_parameters' => $objectParam,
                            'node' => $node,
                        ));
                    }
                    else
                    {
                        $templateOutput = self::fetchTemplate( 'design:content/datatype/view/ezxmltags/' . $tagName . $tplSuffix . '.tpl', array(
                            'view' => $view,
                            'object' => $object,
                            'link_parameters' => array(),
                            'classification' => $className,
                            'object_parameters' => $objectParam,
                        ));
                    }

                    $output .= '<' . $htmlTagName . ' id="' . $idString . '" title="' . $objectName . '"' .
                               $objectAttr . $customAttributePart . $styleString . '>' . $templateOutput .
                               '</' . $htmlTagName . '>';
                }
            }break;

            case 'custom' :
            {
                $name = $tag->getAttribute( 'name' );
                $align = $tag->getAttribute( 'align' );
                $customAttributePart = self::getCustomAttrPart( $tag, $styleString );
                $inline = self::customTagIsInline( $name );
                if ( $align )
                {
                    $customAttributePart .= ' align="' . $align . '"';
                }

                if ( isset( self::$nativeCustomTags[ $name ] ))
                {
                    if ( !$childTagText ) $childTagText = '&nbsp;';
                    $output .= '<' . self::$nativeCustomTags[ $name ] . $customAttributePart . $styleString .
                               '>' . $childTagText . '</' . self::$nativeCustomTags[ $name ] . '>';
                }
                else if ( $inline === true )
                {
                    if ( !$childTagText ) $childTagText = '&nbsp;';
                    $tagName = $name === 'underline' ? 'u' : 'span';
                    $output .= '<' . $tagName . ' class="ezoeItemCustomTag ' . $name . '" type="custom"' .
                               $customAttributePart . $styleString . '>' . $childTagText . '</' . $tagName . '>';
                }
                else if ( $inline )
                {
                    $imageUrl = self::getCustomAttribute( $tag, 'image_url' );
                    if ( $imageUrl === null || !$imageUrl )
                    {
                        $imageUrl = self::getDesignFile( $inline );
                        $customAttributePart .= ' width="22" height="22"';
                    }
                    $output .= '<img src="' . $imageUrl . '" class="ezoeItemCustomTag ' . $name .
                               '" type="custom"' . $customAttributePart . $styleString . ' />';
                }
                else if ( $tag->textContent === '' && !$tag->hasChildNodes() )
                {
                    // for empty custom tag, just put a paragraph with the name
                    // of the custom tag in to handle it in the rich text editor
                    $output .= '<div class="ezoeItemCustomTag ' . $name . '" type="custom"' .
                                    $customAttributePart . $styleString . '><p>' . $name . '</p></div>';
                }
                else
                {
                    $customTagContent = $this->inputSectionXML( $tag, $currentSectionLevel, $tdSectionLevel );
                    /*foreach ( $tag->childNodes as $tagChild )
                    {
                        $customTagContent .= $this->inputTdXML( $tagChild,
                                                                $currentSectionLevel,
                                                                $tdSectionLevel );
                    }*/
                    $output .= '<div class="ezoeItemCustomTag ' . $name . '" type="custom"' .
                               $customAttributePart . $styleString . '>' . $customTagContent . '</div>';
                }
            }break;

            case 'literal' :
            {
                $literalText = '';
                foreach ( $tagChildren as $childTag )
                {
                    $literalText .= $childTag->textContent;
                }
                $className = $tag->getAttribute( 'class' );

                $customAttributePart = self::getCustomAttrPart( $tag, $styleString );

                $literalText = htmlspecialchars( $literalText );
                $literalText = str_replace( "\n", '<br />', $literalText );

                if ( $className != '' )
                    $customAttributePart .= ' class="' . $className . '"';

                $output .= '<pre' . $customAttributePart . $styleString . '>' . $literalText . '</pre>';

            }break;

            case 'ul' :
            case 'ol' :
            {
                $listContent = '';

                $customAttributePart = self::getCustomAttrPart( $tag, $styleString );

                // find all list elements
                foreach ( $tag->childNodes as $listItemNode )
                {
                    if ( !$listItemNode instanceof DOMElement )
                    {
                        continue;// ignore whitespace
                    }

                    $LIcustomAttributePart = self::getCustomAttrPart( $listItemNode, $listItemStyleString );

                    $noParagraphs = self::childTagCount( $listItemNode ) <= 1;
                    $listItemContent = '';
                    foreach ( $listItemNode->childNodes as $itemChildNode )
                    {
                        $listSectionLevel = $currentSectionLevel;
                        if ( $itemChildNode instanceof DOMNode
                        && ( $itemChildNode->nodeName === 'section'
                          || $itemChildNode->nodeName === 'paragraph' ) )
                        {
                            $listItemContent .= $this->inputListXML( $itemChildNode,
                                                                     $currentSectionLevel,
                                                                     $listSectionLevel,
                                                                     $noParagraphs );
                        }
                        else
                        {
                            $listItemContent .= $this->inputTagXML( $itemChildNode,
                                                                    $currentSectionLevel,
                                                                    $tdSectionLevel );
                        }
                    }

                    $LIclassName = $listItemNode->getAttribute( 'class' );

                    if ( $LIclassName )
                        $LIcustomAttributePart .= ' class="' . $LIclassName . '"';

                    $listContent .= '<li' . $LIcustomAttributePart . $listItemStyleString . '>' .
                                    $listItemContent . '</li>';
                }
                $className = $tag->getAttribute( 'class' );
                if ( $className != '' )
                    $customAttributePart .= ' class="' . $className . '"';

                $output .= '<' . $tagName . $customAttributePart . $styleString . '>' . $listContent . '</' .
                           $tagName . '>';
            }break;

            case 'table' :
            {
                $tableRows = '';
                $border = $tag->getAttribute( 'border' );
                $width = $tag->getAttribute( 'width' );
                $align = $tag->getAttribute( 'align' );
                $tableClassName = $tag->getAttribute( 'class' );

                $customAttributePart = self::getCustomAttrPart( $tag, $styleString );

                // find all table rows
                foreach ( $tag->childNodes as $tableRow )
                {
                    if ( !$tableRow instanceof DOMElement )
                    {
                        continue; // ignore whitespace
                    }
                    $TRcustomAttributePart = self::getCustomAttrPart( $tableRow, $tableRowStyleString );
                    $TRclassName = $tableRow->getAttribute( 'class' );

                    $tableData = '';
                    foreach ( $tableRow->childNodes as $tableCell )
                    {
                        if ( !$tableCell instanceof DOMElement )
                        {
                            continue; // ignore whitespace
                        }

                        $TDcustomAttributePart = self::getCustomAttrPart( $tableCell, $tableCellStyleString );

                        $className = $tableCell->getAttribute( 'class' );
                        $cellAlign = $tableCell->getAttribute( 'align' );

                        $colspan = $tableCell->getAttributeNS( 'http://ez.no/namespaces/ezpublish3/xhtml/',
                                                               'colspan' );
                        $rowspan = $tableCell->getAttributeNS( 'http://ez.no/namespaces/ezpublish3/xhtml/',
                                                               'rowspan' );
                        $cellWidth = $tableCell->getAttributeNS( 'http://ez.no/namespaces/ezpublish3/xhtml/',
                                                                 'width' );
                        if ( $className != '' )
                        {
                            $TDcustomAttributePart .= ' class="' . $className . '"';
                        }
                        if ( $cellWidth != '' )
                        {
                            $TDcustomAttributePart .= ' width="' . $cellWidth . '"';
                        }
                        if ( $colspan && $colspan !== '1' )
                        {
                            $TDcustomAttributePart .= ' colspan="' . $colspan . '"';
                        }
                        if ( $rowspan && $rowspan !== '1' )
                        {
                            $TDcustomAttributePart .= ' rowspan="' . $rowspan . '"';
                        }
                        if ( $cellAlign )
                        {
                        	$TDcustomAttributePart .= ' align="' . $cellAlign . '"';
                        }
                        $cellContent = '';
                        $tdSectionLevel = $currentSectionLevel;
                        foreach ( $tableCell->childNodes as $tableCellChildNode )
                        {
                            $cellContent .= $this->inputTdXML( $tableCellChildNode,
                                                               $currentSectionLevel,
                                                               $tdSectionLevel - $currentSectionLevel );
                        }
                        if ( $cellContent === '' )
                        {
                            // tinymce has some issues with empty content in some browsers
                            if ( self::browserSupportsDHTMLType() != 'Trident' )
                                $cellContent = '<p><br data-mce-bogus="1"/></p>';
                        }
                        if ( $tableCell->nodeName === 'th' )
                        {
                            $tableData .= '<th' . $TDcustomAttributePart . $tableCellStyleString . '>' .
                                          $cellContent . '</th>';
                        }
                        else
                        {
                            $tableData .= '<td' . $TDcustomAttributePart . $tableCellStyleString . '>' .
                                          $cellContent . '</td>';
                        }
                    }
                    if ( $TRclassName )
                        $TRcustomAttributePart .= ' class="' . $TRclassName . '"';

                    $tableRows .= '<tr' . $TRcustomAttributePart . $tableRowStyleString . '>' .
                                  $tableData . '</tr>';
                }
                //if ( self::browserSupportsDHTMLType() === 'Trident' )
                //{
                    $customAttributePart .= ' width="' . $width . '"';
                /*}
                else
                {
                    // if this is reenabled merge it with $styleString
                    $customAttributePart .= ' style="width:' . $width . ';"';
                }*/

                if ( $border !== '' && is_string( $border ) )
                {
                    if ( $border === '0%' )
                        $border = '0';// Strip % if 0 to make sure TinyMCE shows a dotted border

                    $customAttributePart .= ' border="' . $border . '"';
                }

                if ( $align )
                {
                    $customAttributePart .= ' align="' . $align . '"';
                }

                if ( $tableClassName )
                {
                    $customAttributePart .= ' class="' . $tableClassName . '"';
                }

                $output .= '<table' . $customAttributePart . $styleString . '><tbody>' . $tableRows .
                           '</tbody></table>';
            }break;

            // normal content tags
            case 'emphasize' :
            {
                $customAttributePart = self::getCustomAttrPart( $tag, $styleString );

                $className = $tag->getAttribute( 'class' );
                if ( $className )
                {
                    $customAttributePart .= ' class="' . $className . '"';
                }
                $output .= '<em' . $customAttributePart . $styleString . '>' . $childTagText  . '</em>';
            }break;

            case 'strong' :
            {
                $customAttributePart = self::getCustomAttrPart( $tag, $styleString );

                $className = $tag->getAttribute( 'class' );
                if ( $className  )
                {
                    $customAttributePart .= ' class="' . $className . '"';
                }
                $output .= '<strong' . $customAttributePart . $styleString . '>' . $childTagText  . '</strong>';
            }break;

            case 'line' :
            {
                $output .= $childTagText . '<br />';
            }break;

            case 'anchor' :
            {
                $name = $tag->getAttribute( 'name' );

                $customAttributePart = self::getCustomAttrPart( $tag, $styleString );

                $output .= '<a name="' . $name . '" class="mceItemAnchor"' . $customAttributePart .
                           $styleString . '></a>';
            }break;

            case 'link' :
            {
                $customAttributePart = self::getCustomAttrPart( $tag, $styleString );

                $linkID = $tag->getAttribute( 'url_id' );
                $target = $tag->getAttribute( 'target' );
                $className = $tag->getAttribute( 'class' );
                $viewName = $tag->getAttribute( 'view' );
                $objectID = $tag->getAttribute( 'object_id' );
                $nodeID = $tag->getAttribute( 'node_id' );
                $anchorName = $tag->getAttribute( 'anchor_name' );
                $showPath = $tag->getAttribute( 'show_path' );
                $htmlID = $tag->getAttributeNS( 'http://ez.no/namespaces/ezpublish3/xhtml/', 'id' );
                $htmlTitle = $tag->getAttributeNS( 'http://ez.no/namespaces/ezpublish3/xhtml/', 'title' );
                $attributes = array();

                if ( $objectID != null )
                {
                    $href = 'ezobject://' .$objectID;
                }
                elseif ( $nodeID != null )
                {
                    if ( $showPath === 'true' )
                    {
                        $node = eZContentObjectTreeNode::fetch( $nodeID );
                        $href = $node ?
                                'eznode://' . $node->attribute('path_identification_string') :
                                'eznode://' . $nodeID;
                    }
                    else
                    {
                        $href = 'eznode://' . $nodeID;
                    }
                }
                elseif ( $linkID != null )
                {
                    $href = eZURL::url( $linkID );
                }
                else
                {
                    $href = $tag->getAttribute( 'href' );
                }

                if ( $anchorName != null )
                {
                    $href .= '#' . $anchorName;
                }

                if ( $className != '' )
                {
                    $attributes[] = 'class="' . $className . '"';
                }

                if ( $viewName != '' )
                {
                    $attributes[] = 'view="' . $viewName . '"';
                }

                $attributes[] = 'href="' . $href . '"';
                // Also set mce_href for use by OE to make sure href attribute is not messed up by IE 6 / 7
                $attributes[] = 'data-mce-href="' . $href . '"';
                if ( $target != '' )
                {
                    $attributes[] = 'target="' . $target . '"';
                }
                if ( $htmlTitle != '' )
                {
                    $attributes[] = 'title="' . $htmlTitle . '"';
                }
                if ( $htmlID != '' )
                {
                   $attributes[] = 'id="' . $htmlID . '"';
                }

                $attributeText = '';
                if ( !empty( $attributes ) )
                {
                    $attributeText = ' ' .implode( ' ', $attributes );
                }
                $output .= '<a' . $attributeText . $customAttributePart . $styleString . '>' .
                           $childTagText . '</a>';
            }break;
            case 'tr' :
            case 'td' :
            case 'th' :
            case 'li' :
            case 'paragraph' :
            {
            }break;
            default :
            {

            }break;
        }
        return $output;
    }
1224123
function to_xml(){
		if ($this->skip) return "";
		$str="";
		for ($i = 0; $i < count($this->config->data); $i++) {
			$str .= "<".$this->config->data[$i]['name']."><![CDATA[".$this->data[$this->config->data[$i]['name']]."]]></".$this->config->data[$i]['name'].">";
		}
		return $str;
	}
606679
function loadXML(xml) {
            if (DOMParser) {
                try {
                    var domParser = new DOMParser();
                    var xmlDoc = domParser.parseFromString(xml, 'text/xml');
                    return xmlDoc;
                }
                catch (exp) {
                    error.raise(10103);
                }
            }
            error.raise(10004);
        }
537204
function output_as_xml($results){
		LogMaster::log("Edit operation finished",$results);
		ob_clean();
		header("Content-type:text/xml");
		echo "<?xml version='1.0' ?>";
		echo "<data>";
		for ($i=0; $i < sizeof($results); $i++)
			echo $results[$i]->to_xml();
		echo "</data>";
	}
1331957
function initializeObjectAttribute( $contentObjectAttribute, $currentVersion, $originalContentObjectAttribute )
    {
        if ( $currentVersion != false )
        {
            $xmlText = eZXMLTextType::rawXMLText( $originalContentObjectAttribute );
            $contentObjectAttribute->setAttribute( "data_text", $xmlText );
        }
        else
        {
            $parser = new eZXMLInputParser();
            $doc = $parser->createRootNode();
            $xmlText = eZXMLTextType::domString( $doc );
            $contentObjectAttribute->setAttribute( "data_text", $xmlText );
        }
    }
1374415
function xmlStartElement($parser,$name,$attribs)
		{
			$this->xmlAttrib[$this->xmlCount] = $attribs;
			$this->xmlName[$this->xmlCount] = $name;
			$this->xmlSData[$this->xmlCount] = '$this->makeTableHeader("xml", "xml element", 2);';
			$this->xmlSData[$this->xmlCount] .= '$this->makeTDHeader("xml", "xmlName");';
			$this->xmlSData[$this->xmlCount] .= 'echo "<strong>' . $this->xmlName[$this->xmlCount] . '</strong>".$this->closeTDRow();';
			$this->xmlSData[$this->xmlCount] .= '$this->makeTDHeader("xml", "xmlAttributes");';
			if(count($attribs) > 0) $this->xmlSData[$this->xmlCount] .= '$this->varIsArray($this->xmlAttrib[' . $this->xmlCount . ']);';
			else $this->xmlSData[$this->xmlCount] .= 'echo "&nbsp;";';
			$this->xmlSData[$this->xmlCount] .= 'echo $this->closeTDRow();';
			$this->xmlCount++;
		}
940800
function schemaStartElement($parser, $name, $attrs)
    {

        // position in the total number of elements, starting from 0
        $pos   = $this->position++;
        $depth = $this->depth++;
        // set self as current value for this depth
        $this->depth_array[$depth] = $pos;
        $this->message[$pos]       = ['cdata' => ''];
        if ($depth > 0) {
            $this->defaultNamespace[$pos] = $this->defaultNamespace[$this->depth_array[$depth - 1]];
        } else {
            $this->defaultNamespace[$pos] = FALSE;
        }

        // get element prefix
        if ($prefix = $this->getPrefix($name)) {
            // get unqualified name
            $name = $this->getLocalPart($name);
        } else {
            $prefix = '';
        }

        // loop thru attributes, expanding, and registering namespace declarations
        if (count($attrs) > 0) {
            foreach ($attrs as $k => $v) {
                // if ns declarations, add to class level array of valid namespaces
                if (preg_match('/^xmlns/', $k)) {
                    //$this->xdebug("$k: $v");
                    //$this->xdebug('ns_prefix: '.$this->getPrefix($k));
                    if ($ns_prefix = substr(strrchr($k, ':'), 1)) {
                        //$this->xdebug("Add namespace[$ns_prefix] = $v");
                        $this->namespaces[$ns_prefix] = $v;
                    } else {
                        $this->defaultNamespace[$pos] = $v;
                        if (!$this->getPrefixFromNamespace($v)) {
                            $this->namespaces['ns' . (count($this->namespaces) + 1)] = $v;
                        }
                    }
                    if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema') {
                        $this->XMLSchemaVersion  = $v;
                        $this->namespaces['xsi'] = $v . '-instance';
                    }
                }
            }
            foreach ($attrs as $k => $v) {
                // expand each attribute
                $k          = strpos($k, ':') ? $this->expandQname($k) : $k;
                $v          = strpos($v, ':') ? $this->expandQname($v) : $v;
                $eAttrs[$k] = $v;
            }
            $attrs = $eAttrs;
        } else {
            $attrs = [];
        }
        // find status, register data
        switch ($name) {
            case 'all':            // (optional) compositor content for a complexType
            case 'choice':
            case 'group':
            case 'sequence':
                //$this->xdebug("compositor $name for currentComplexType: $this->currentComplexType and currentElement: $this->currentElement");
                $this->complexTypes[$this->currentComplexType]['compositor'] = $name;
                //if($name == 'all' || $name == 'sequence'){
                //	$this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
                //}
                break;
            case 'attribute':    // complexType attribute
                //$this->xdebug("parsing attribute $attrs[name] $attrs[ref] of value: ".$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']);
                $this->xdebug("parsing attribute:");
                $this->appendDebug($this->varDump($attrs));
                if (!isset($attrs['form'])) {
                    // TODO: handle globals
                    $attrs['form'] = $this->schemaInfo['attributeFormDefault'];
                }
                if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) {
                    $v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
                    if (!strpos($v, ':')) {
                        // no namespace in arrayType attribute value...
                        if ($this->defaultNamespace[$pos]) {
                            // ...so use the default
                            $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'] = $this->defaultNamespace[$pos] . ':' . $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
                        }
                    }
                }
                if (isset($attrs['name'])) {
                    $this->attributes[$attrs['name']] = $attrs;
                    $aname                            = $attrs['name'];
                } elseif (isset($attrs['ref']) && $attrs['ref'] == 'http://schemas.xmlsoap.org/soap/encoding/:arrayType') {
                    if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) {
                        $aname = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
                    } else {
                        $aname = '';
                    }
                } elseif (isset($attrs['ref'])) {
                    $aname                           = $attrs['ref'];
                    $this->attributes[$attrs['ref']] = $attrs;
                }

                if ($this->currentComplexType) {    // This should *always* be
                    $this->complexTypes[$this->currentComplexType]['attrs'][$aname] = $attrs;
                }
                // arrayType attribute
                if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']) || $this->getLocalPart($aname) == 'arrayType') {
                    $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
                    $prefix                                                   = $this->getPrefix($aname);
                    if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) {
                        $v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
                    } else {
                        $v = '';
                    }
                    if (strpos($v, '[,]')) {
                        $this->complexTypes[$this->currentComplexType]['multidimensional'] = TRUE;
                    }
                    $v = substr($v, 0, strpos($v, '[')); // clip the []
                    if (!strpos($v, ':') && isset($this->typemap[$this->XMLSchemaVersion][$v])) {
                        $v = $this->XMLSchemaVersion . ':' . $v;
                    }
                    $this->complexTypes[$this->currentComplexType]['arrayType'] = $v;
                }
                break;
            case 'complexContent':    // (optional) content for a complexType
                $this->xdebug("do nothing for element $name");
                break;
            case 'complexType':
                array_push($this->complexTypeStack, $this->currentComplexType);
                if (isset($attrs['name'])) {
                    // TODO: what is the scope of named complexTypes that appear
                    //       nested within other c complexTypes?
                    $this->xdebug('processing named complexType ' . $attrs['name']);
                    //$this->currentElement = false;
                    $this->currentComplexType                                   = $attrs['name'];
                    $this->complexTypes[$this->currentComplexType]              = $attrs;
                    $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType';
                    // This is for constructs like
                    //           <complexType name="ListOfString" base="soap:Array">
                    //                <sequence>
                    //                    <element name="string" type="xsd:string"
                    //                        minOccurs="0" maxOccurs="unbounded" />
                    //                </sequence>
                    //            </complexType>
                    if (isset($attrs['base']) && preg_match('/:Array$/', $attrs['base'])) {
                        $this->xdebug('complexType is unusual array');
                        $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
                    } else {
                        $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
                    }
                } else {
                    $name = $this->CreateTypeName($this->currentElement);
                    $this->xdebug('processing unnamed complexType for element ' . $this->currentElement . ' named ' . $name);
                    $this->currentComplexType = $name;
                    //$this->currentElement = false;
                    $this->complexTypes[$this->currentComplexType]              = $attrs;
                    $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType';
                    // This is for constructs like
                    //           <complexType name="ListOfString" base="soap:Array">
                    //                <sequence>
                    //                    <element name="string" type="xsd:string"
                    //                        minOccurs="0" maxOccurs="unbounded" />
                    //                </sequence>
                    //            </complexType>
                    if (isset($attrs['base']) && preg_match('/:Array$/', $attrs['base'])) {
                        $this->xdebug('complexType is unusual array');
                        $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
                    } else {
                        $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
                    }
                }
                $this->complexTypes[$this->currentComplexType]['simpleContent'] = 'false';
                break;
            case 'element':
                array_push($this->elementStack, $this->currentElement);
                if (!isset($attrs['form'])) {
                    if ($this->currentComplexType) {
                        $attrs['form'] = $this->schemaInfo['elementFormDefault'];
                    } else {
                        // global
                        $attrs['form'] = 'qualified';
                    }
                }
                if (isset($attrs['type'])) {
                    $this->xdebug("processing typed element " . $attrs['name'] . " of type " . $attrs['type']);
                    if (!$this->getPrefix($attrs['type'])) {
                        if ($this->defaultNamespace[$pos]) {
                            $attrs['type'] = $this->defaultNamespace[$pos] . ':' . $attrs['type'];
                            $this->xdebug('used default namespace to make type ' . $attrs['type']);
                        }
                    }
                    // This is for constructs like
                    //           <complexType name="ListOfString" base="soap:Array">
                    //                <sequence>
                    //                    <element name="string" type="xsd:string"
                    //                        minOccurs="0" maxOccurs="unbounded" />
                    //                </sequence>
                    //            </complexType>
                    if ($this->currentComplexType && $this->complexTypes[$this->currentComplexType]['phpType'] == 'array') {
                        $this->xdebug('arrayType for unusual array is ' . $attrs['type']);
                        $this->complexTypes[$this->currentComplexType]['arrayType'] = $attrs['type'];
                    }
                    $this->currentElement = $attrs['name'];
                    $ename                = $attrs['name'];
                } elseif (isset($attrs['ref'])) {
                    $this->xdebug("processing element as ref to " . $attrs['ref']);
                    $this->currentElement = "ref to " . $attrs['ref'];
                    $ename                = $this->getLocalPart($attrs['ref']);
                } else {
                    $type = $this->CreateTypeName($this->currentComplexType . '_' . $attrs['name']);
                    $this->xdebug("processing untyped element " . $attrs['name'] . ' type ' . $type);
                    $this->currentElement = $attrs['name'];
                    $attrs['type']        = $this->schemaTargetNamespace . ':' . $type;
                    $ename                = $attrs['name'];
                }
                if (isset($ename) && $this->currentComplexType) {
                    $this->xdebug("add element $ename to complexType $this->currentComplexType");
                    $this->complexTypes[$this->currentComplexType]['elements'][$ename] = $attrs;
                } elseif (!isset($attrs['ref'])) {
                    $this->xdebug("add element $ename to elements array");
                    $this->elements[$attrs['name']]              = $attrs;
                    $this->elements[$attrs['name']]['typeClass'] = 'element';
                }
                break;
            case 'enumeration':    //	restriction value list member
                $this->xdebug('enumeration ' . $attrs['value']);
                if ($this->currentSimpleType) {
                    $this->simpleTypes[$this->currentSimpleType]['enumeration'][] = $attrs['value'];
                } elseif ($this->currentComplexType) {
                    $this->complexTypes[$this->currentComplexType]['enumeration'][] = $attrs['value'];
                }
                break;
            case 'extension':    // simpleContent or complexContent type extension
                $this->xdebug('extension ' . $attrs['base']);
                if ($this->currentComplexType) {
                    $ns = $this->getPrefix($attrs['base']);
                    if ($ns == '') {
                        $this->complexTypes[$this->currentComplexType]['extensionBase'] = $this->schemaTargetNamespace . ':' . $attrs['base'];
                    } else {
                        $this->complexTypes[$this->currentComplexType]['extensionBase'] = $attrs['base'];
                    }
                } else {
                    $this->xdebug('no current complexType to set extensionBase');
                }
                break;
            case 'import':
                if (isset($attrs['schemaLocation'])) {
                    $this->xdebug('import namespace ' . $attrs['namespace'] . ' from ' . $attrs['schemaLocation']);
                    $this->imports[$attrs['namespace']][] = ['location' => $attrs['schemaLocation'], 'loaded' => FALSE];
                } else {
                    $this->xdebug('import namespace ' . $attrs['namespace']);
                    $this->imports[$attrs['namespace']][] = ['location' => '', 'loaded' => TRUE];
                    if (!$this->getPrefixFromNamespace($attrs['namespace'])) {
                        $this->namespaces['ns' . (count($this->namespaces) + 1)] = $attrs['namespace'];
                    }
                }
                break;
            case 'include':
                if (isset($attrs['schemaLocation'])) {
                    $this->xdebug('include into namespace ' . $this->schemaTargetNamespace . ' from ' . $attrs['schemaLocation']);
                    $this->imports[$this->schemaTargetNamespace][] = ['location' => $attrs['schemaLocation'], 'loaded' => FALSE];
                } else {
                    $this->xdebug('ignoring invalid XML Schema construct: include without schemaLocation attribute');
                }
                break;
            case 'list':    // simpleType value list
                $this->xdebug("do nothing for element $name");
                break;
            case 'restriction':    // simpleType, simpleContent or complexContent value restriction
                $this->xdebug('restriction ' . $attrs['base']);
                if ($this->currentSimpleType) {
                    $this->simpleTypes[$this->currentSimpleType]['type'] = $attrs['base'];
                } elseif ($this->currentComplexType) {
                    $this->complexTypes[$this->currentComplexType]['restrictionBase'] = $attrs['base'];
                    if (strstr($attrs['base'], ':') == ':Array') {
                        $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
                    }
                }
                break;
            case 'schema':
                $this->schemaInfo                  = $attrs;
                $this->schemaInfo['schemaVersion'] = $this->getNamespaceFromPrefix($prefix);
                if (isset($attrs['targetNamespace'])) {
                    $this->schemaTargetNamespace = $attrs['targetNamespace'];
                }
                if (!isset($attrs['elementFormDefault'])) {
                    $this->schemaInfo['elementFormDefault'] = 'unqualified';
                }
                if (!isset($attrs['attributeFormDefault'])) {
                    $this->schemaInfo['attributeFormDefault'] = 'unqualified';
                }
                break;
            case 'simpleContent':    // (optional) content for a complexType
                if ($this->currentComplexType) {    // This should *always* be
                    $this->complexTypes[$this->currentComplexType]['simpleContent'] = 'true';
                } else {
                    $this->xdebug("do nothing for element $name because there is no current complexType");
                }
                break;
            case 'simpleType':
                array_push($this->simpleTypeStack, $this->currentSimpleType);
                if (isset($attrs['name'])) {
                    $this->xdebug("processing simpleType for name " . $attrs['name']);
                    $this->currentSimpleType                        = $attrs['name'];
                    $this->simpleTypes[$attrs['name']]              = $attrs;
                    $this->simpleTypes[$attrs['name']]['typeClass'] = 'simpleType';
                    $this->simpleTypes[$attrs['name']]['phpType']   = 'scalar';
                } else {
                    $name = $this->CreateTypeName($this->currentComplexType . '_' . $this->currentElement);
                    $this->xdebug('processing unnamed simpleType for element ' . $this->currentElement . ' named ' . $name);
                    $this->currentSimpleType = $name;
                    //$this->currentElement = false;
                    $this->simpleTypes[$this->currentSimpleType]            = $attrs;
                    $this->simpleTypes[$this->currentSimpleType]['phpType'] = 'scalar';
                }
                break;
            case 'union':    // simpleType type list
                $this->xdebug("do nothing for element $name");
                break;
            default:
                $this->xdebug("do not have any logic to process element $name");
        }
    }
991117
function xmlDefaultHandler($parser,$data)
		{
			//strip '<!--' and '-->' off comments
			$data = repl(array("&lt;!--", "--&gt;"), "", htmlspecialchars($data));
			$count = $this->xmlCount - 1;
			if(!empty($this->xmlDData[$count])) $this->xmlDData[$count] .= $data;
			else $this->xmlDData[$count] = $data;
		}
507233
def to_string(self, indent="", newl="", addindent=""):
        '''
        
        '''
        buf = StringIO()
        self.to_xml().writexml(buf, indent=indent, addindent=addindent,
                               newl=newl)
        return buf.getvalue()
1218151
def to_xml_string(str = '')
      str << '<border '
      serialized_attributes str
      str << '>'
      # enforces order
      [:start, :end, :left, :right, :top, :bottom, :diagonal, :vertical, :horizontal].each do |k|
        @prs.select { |pr| pr.name == k }.each do |part|
          part.to_xml_string(str)
        end
      end
      str << '</border>'
    end
768419
function (data) {
            // already a xml
            if (data.documentElement) {
                return data;
            }
            var xml;
            try {
                // Standard
                if (win.DOMParser) {
                    xml = new DOMParser().parseFromString(data, 'text/xml');
                } else {
                    // IE
                    /*global ActiveXObject*/
                    xml = new ActiveXObject('Microsoft.XMLDOM');
                    xml.async = false;
                    xml.loadXML(data);
                }
            } catch (e) {
                logger.error('parseXML error :');
                logger.error(e);
                xml = undef;
            }
            if (!xml || !xml.documentElement || xml.getElementsByTagName('parsererror').length) {
                util.error('Invalid XML: ' + data);
            }
            return xml;
        }
81539
def __init_xml(self, rootElementTag):
        """"""
        xml_root = etree.Element(rootElementTag)
        key = etree.SubElement(xml_root, "Key")
        key.text = self.apikey
        return xml_root
192940
static function simpleXmlToArray(SimpleXMLElement &$source)
  {
    $res = array();
    $children = false;
    foreach ($source as $key => $value) {
        CPS_Response::simpleXmlToArrayHelper($res, $key, $value, $children);
    }
    if ($source) {
      foreach ($source->children('www.clusterpoint.com') as $key => $value) {
        $newkey = 'cps:' . $key;
        CPS_Response::simpleXmlToArrayHelper($res, $newkey, $value, $children);
      }
    }
    if (!$children)
      return (string)$source;
    return $res;
  }