Builds the XQuery as a string. Uses the default format of looping through all apply nodes.

@return XQuery as string
359345
protected String getDefaultString() {
        final StringBuilder output = new StringBuilder();
        // append headers e.g. namespaces and functions
        output.append(String.join("\n", getHeaders()));

        if (!qvarMapVariable.isEmpty() && addQvarMap) {
            output.append(qvarMapVariable).append("\n");
        }

        output.append("for $m in ").append(getPathToRoot()).append(" return\n")
                .append("for $x in $m//*:").append(NonWhitespaceNodeList.getFirstChild(getMainElement()).getLocalName())
                .append("\n").append(getExactMatchXQuery());

        if (!getLengthConstraint().isEmpty() || !qvarConstraint.isEmpty()) {
            output.append("\n").append("where").append("\n");
            if (getLengthConstraint().isEmpty()) {
                output.append(qvarConstraint);
            } else {
                output.append(getLengthConstraint())
                        .append(qvarConstraint.isEmpty() ? "" : "\n and ").append(qvarConstraint);
            }
        }
        // append return format
        output.append("\n\n").append("return").append("\n").append(getReturnFormat());

        // append footers e.g. closing fences from headers
        output.append(String.join("\n", getFooters()));
        return output.toString();
    }
312539
public function toString()
    {
        $this->parts = array();
        $this->params = array();
        $this->assemble();
        $this->query = join(' ', $this->parts);
        if( $this->interpolation ) {
            $this->interpolateParams();
        }
        return $this->query;
    }
1046213
function xmlString( )
    {
        $doc = new DOMDocument( '1.0', 'utf-8' );

        $root = $doc->createElement( "ezoption" );
        $doc->appendChild( $root );

        $name = $doc->createElement( "name" );
        $name->appendChild( $doc->createCDATASection( $this->Name ) );
        $root->appendChild( $name );

        $options = $doc->createElement( "options" );
        $root->appendChild( $options );

        foreach ( $this->Options as $option )
        {
            $optionNode = $doc->createElement( "option" );
            $optionNode->appendChild( $doc->createCDATASection( $option["value"] ) );
            $optionNode->setAttribute( "id", $option['id'] );
            $optionNode->setAttribute( 'additional_price', $option['additional_price'] );
            $options->appendChild( $optionNode );
        }

        $xml = $doc->saveXML();

        return $xml;
    }
1346287
public String toXML()
    {
        RepositoryTags tags = RepositoryTags.getInstance();
        String eol = SystemUtils.LINE_SEPARATOR;

        //opening tag + attributes
        StringBuffer result = new StringBuffer( 1024 );
        result.append( "      " );
        result.append( tags.getOpeningTagNonClosingById( FIELD_DESCRIPTOR ) );
        result.append( " " );
        result.append( eol );

        //        // id
        //        String id = new Integer(getColNo()).toString();
        //        result += /*"        " +*/ tags.getAttribute(ID, id) + eol;

        // name
        result.append( "        " );
        result.append( tags.getAttribute( FIELD_NAME, this.getAttributeName() ) );
        result.append( eol );

        // table not yet implemented

        // column
        result.append( "        " );
        result.append( tags.getAttribute( COLUMN_NAME, this.getColumnName() ) );
        result.append( eol );

        // jdbc-type
        result.append( "        " );
        result.append( tags.getAttribute( JDBC_TYPE, this.getColumnType() ) );
        result.append( eol );

        // primarykey
        if( this.isPrimaryKey() )
        {
            result.append( "        " );
            result.append( tags.getAttribute( PRIMARY_KEY, "true" ) );
            result.append( eol );
        }

        // nullable
        if( this.isRequired() )
        {
            result.append( "        " );
            result.append( tags.getAttribute( NULLABLE, "false" ) );
            result.append( eol );
        }

        // indexed not yet implemented

        // autoincrement
        if( this.isAutoIncrement() )
        {
            result.append( "        " );
            result.append( tags.getAttribute( AUTO_INCREMENT, "true" ) );
            result.append( eol );
        }

        // locking
        if( this.isLocking() )
        {
            result.append( "        " );
            result.append( tags.getAttribute( LOCKING, "true" ) );
            result.append( eol );
        }

        // updateLock
        // default is true so only write if false
        if( !this.isUpdateLock() )
        {
            result.append( "        " );
            result.append( tags.getAttribute( UPDATE_LOCK, "false" ) );
            result.append( eol );
        }

        // default-fetch not yet implemented

        // conversion
        if( this.getFieldConversion().getClass() != FieldConversionDefaultImpl.class )
        {
            result.append( "        " );
            result.append( tags.getAttribute( FIELD_CONVERSION, getFieldConversion().getClass().getName() ) );
            result.append( eol );
        }

        // length
        if( this.isLengthSpecified() )
        {
            result.append( "        " );
            result.append( tags.getAttribute( LENGTH, "" + getLength() ) );
            result.append( eol );
        }

        // precision
        if( this.isPrecisionSpecified() )
        {
            result.append( "        " );
            result.append( tags.getAttribute( PRECISION, "" + getPrecision() ) );
            result.append( eol );
        }

        // scale
        if( this.isScaleSpecified() )
        {
            result.append( "        " );
            result.append( tags.getAttribute( SCALE, "" + getScale() ) );
            result.append( eol );
        }

        // access
        result.append( "        " );
        result.append( tags.getAttribute( ACCESS, this.getAccess() ) );
        result.append( eol );

        result.append( "      />" );
        result.append( eol );
        return result.toString();
    }
374323
protected function buildQuery()
	{
		$this->setup();

		$query = array();

		// Index always needs to be provided. _all means a cross index search.
		$query['index'] = empty($this->indices) ? '_all' : implode(',', array_values($this->indices));

		// Type is not required, will search in the entire index.
		if (!empty($this->types)) {
			$query['type'] = implode(',', array_values($this->types));
		}

		// Replace Fragments with their raw body.
		$query['body'] = $this->fragmentParser->parse($this->body);

		// Add all query string params, the SDK will only add known params to the URL.
		foreach ($this->queryStringParams as $paramName => $paramValue) {
			$query[$paramName] = $paramValue;
		}

		return $query;
	}
681302
public function toString()
    {
        $result = '';

        if (!empty($this->scheme)) {
            $result.= $this->scheme . ':';
        }

        if (!empty($this->authority)) {
            $result.= '//' . $this->authority;
        }

        $result.= $this->path;

        if (!empty($this->query)) {
            $result.= '?' . $this->query;
        }

        if (!empty($this->fragment)) {
            $result.= '#' . $this->fragment;
        }

        return $result;
    }
801169
public function convertExpressionsToStrings()
    {
        $this->setMainQuery((string) $this->getMainQuery());

        $this->setFilterQueries(array_map(
            function($expr) { return (string) $expr; },
            $this->getFilterQueries()
        ));

        return $this;
    }
944903
public String toXML()
    {
        RepositoryTags tags = RepositoryTags.getInstance();
        String eol = SystemUtils.LINE_SEPARATOR;

        // write opening tag
        String result = "      " + tags.getOpeningTagNonClosingById(COLLECTION_DESCRIPTOR) + eol;

        // write attributes
        // name
        result       += "        " + tags.getAttribute(FIELD_NAME,this.getAttributeName()) + eol;

        // collection class is optional
        if (getCollectionClassName() != null)
        {
            result       += "        " + tags.getAttribute(COLLECTION_CLASS,this.getCollectionClassName()) + eol;
        }

        // element-class-ref
         result       += "        " + tags.getAttribute(ITEMS_CLASS,this.getItemClassName()) + eol;

        // indirection-table is optional
        if (isMtoNRelation())
        {
             result += "        " + tags.getAttribute(INDIRECTION_TABLE,getIndirectionTable()) + eol;
        }

        // proxyReference is optional, disabled by default
        if (isLazy())
        {
            result       += "        " + tags.getAttribute(PROXY_REFERENCE,"true") + eol;
            result       += "        " + tags.getAttribute(PROXY_PREFETCHING_LIMIT, "" + this.getProxyPrefetchingLimit()) + eol;
        }

        //reference refresh is optional, disabled by default
        if (isRefresh())
        {
             result       += "        " + tags.getAttribute(REFRESH,"true") + eol;
        }

        //auto retrieve
        result += "        " + tags.getAttribute(AUTO_RETRIEVE, "" + getCascadeRetrieve()) + eol;

        //auto update
        result += "        " + tags.getAttribute(AUTO_UPDATE, getCascadeAsString(getCascadingStore())) + eol;

        //auto delete
        result += "        " + tags.getAttribute(AUTO_DELETE, getCascadeAsString(getCascadingDelete())) + eol;

        //otm-dependent is optional, disabled by default
        if (getOtmDependent())
        {
            result += "        " + tags.getAttribute(OTM_DEPENDENT, "true") + eol;
        }

        // close opening tag
        result       += "      >" + eol;

        // write elements
         // inverse fk elements
        for (int i=0;i<getForeignKeyFields().size();i++)
        {
        Object obj = getForeignKeyFields().get(i);
        if (obj instanceof Integer)
        {
                String fkId = obj.toString();
            result += "        " + tags.getOpeningTagNonClosingById(INVERSE_FK) + " ";
                result += tags.getAttribute(FIELD_ID_REF, fkId) + "/>" + eol;
        }
        else
        {
                String fk = (String) obj;
            result += "        " + tags.getOpeningTagNonClosingById(INVERSE_FK) + " ";
                result += tags.getAttribute(FIELD_REF, fk) + "/>" + eol;
        }
        }

        // write optional M:N elements
        // m:n relationship settings, optional
        if (isMtoNRelation())
        {
            // foreign keys to this class
             for (int i=0;i<getFksToThisClass().length;i++)
             {
                String fkId = getFksToThisClass()[i];
                result += "        " + tags.getOpeningTagNonClosingById(FK_POINTING_TO_THIS_CLASS) + " ";
                result += tags.getAttribute(COLUMN_NAME, fkId) + "/>" + eol;
             }

            // foreign keys to item class
             for (int i=0;i<getFksToItemClass().length;i++)
             {
                String fkId = getFksToItemClass()[i];
                result += "        " + tags.getOpeningTagNonClosingById(FK_POINTING_TO_ITEMS_CLASS) + " ";
                result += tags.getAttribute(COLUMN_NAME, fkId) + "/>" + eol;
             }
        }

        // closing tag
        result       += "      " + tags.getClosingTagById(COLLECTION_DESCRIPTOR) + eol;
        return result;
    }
749644
function to_xml(){
		$str="<action type='{$this->status}' sid='{$this->id}' tid='{$this->nid}' ";
		foreach ($this->attrs as $k => $v) {
			$str.=$k."='".$this->xmlentities($v)."' ";
		}
		$str.=">{$this->output}</action>";	
		return $str;
	}
671222
public function getXMLContent()
    {
        if ($this->xmlContent === null) {
            try {
                if (($content = $this->content) === '') {
                    return $this->xmlContent = false;
                }

                $errors = libxml_use_internal_errors(true);
                $this->xmlContent = new SimpleXMLElement($content);
                libxml_use_internal_errors($errors);
            } catch (Exception $exception) {
                return $this->xmlContent = false;
            }
        }

        return $this->xmlContent;
    }
92026
public function to_xml(){
        $str= "<update ";
		$str .= 'status="'.$this->data['action_table_type'].'" ';
		$str .= 'id="'.$this->data['dataId'].'" ';
		$str .= 'parent="'.$this->get_parent_id().'"';
		$str .= '>';
		$str .= $this->child->to_xml();
		$str .= '</update>';
        return $str;
	}
545899
protected function buildXml()
	{
		$buffer = array();

		$buffer[] = '<?xml version="1.0"?>';
		$buffer[] = '<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">';
		$buffer[] = ' <database name="">';

		$buffer = array_merge($buffer, $this->buildXmlStructure());

		$buffer[] = ' </database>';
		$buffer[] = '</mysqldump>';

		return implode("\n", $buffer);
	}
787180
public function generateXMLRequestString()
    {
        $enabledMetadataTypes = array();
        if ($this->enableSocialTags) {
            $enabledMetadataTypes[] = 'GenericRelations';
        }
        if ($this->enableGenericRelations) {
            $enabledMetadataTypes[] = 'SocialTags';
        }

        $xml  = '<c:params xmlns:c="http://s.opencalais.com/1/pred/" ';
        $xml .= 'xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">';
        $xml .= '<c:processingDirectives ';
        $xml .= 'c:contentType="' . $this->contentType . '" ';
        $xml .= 'c:enableMetadataType="' . implode(',', $enabledMetadataTypes) . '" ';
        $xml .= 'c:outputFormat="' . $this->outputFormat . '" ';
        $xml .= 'c:docRDFaccessible="' . ($this->docRDFaccessible ? 'true' : 'false') . '" ';
        $xml .= '></c:processingDirectives>';
        $xml .= '<c:userDirectives ';
        $xml .= 'c:allowDistribution="' . ($this->allowDistribution ? 'true' : 'false') . '" ';
        $xml .= 'c:allowSearch="' . ($this->allowSearch ? 'true' : 'false') . '" ';
        $xml .= '></c:userDirectives>';
        $xml .= '<c:externalMetadata></c:externalMetadata>';
        $xml .= '</c:params>';

        return $xml;
    }
819106
public function generateXml()
    {
        $xml = $this->getUpdate()->asSimplexml();
        $removeInstructions = $xml->xpath("//remove");
        if (is_array($removeInstructions)) {
            foreach ($removeInstructions as $infoNode) {
                /** @var Mage_Core_Model_Layout_Element $infoNode */
                if (!$this->checkConditionals($infoNode, false)) {
                    continue;
                }
                $blockName = trim((string)$infoNode['name']);
                if ($blockName) {
                    $ignoreNodes = $xml->xpath("//block[@name='" . $blockName . "'] | //reference[@name='" . $blockName . "']");
                    if (is_array($ignoreNodes)) {
                        foreach ($ignoreNodes as $ignoreNode) {
                            /** @var Mage_Core_Model_Layout_Element $ignoreNode */
                            $ignoreNode['ignore'] = true;
                        }
                    }
                }
            }
        }
        $this->setXml($xml);
        return $this;
    }
466649
protected function buildQueryString() {

		$w = [];
		$s = [];

		$qc = $this->quoteChar;

		// start SQL statement

		$this->sql = 'SELECT ';

		// add columns

		if(!$this->columns || !count($this->columns)) {
			$this->sql .= '*';
		}
		else {
			
			$this->sql .= $qc . str_replace('.', $qc . '.' . $qc, implode($qc . ',' . $qc, $this->columns)) . $qc;
				
		}

		// add table

		$this->sql .= ' FROM ' . $qc . preg_replace('/\s+/', $qc . ' ' . $qc, $this->table) . $qc;

		// add alias

		if($this->alias) {
			$this->sql .= ' ' . $qc . $this->alias . $qc;
		}

		// add INNER JOINs

		foreach($this->innerJoins as $join) {
			$this->sql .= sprintf(' INNER JOIN %1$s%2$s%1$s ON %3$s', $qc, preg_replace('/\s+/', $qc . ' ' . $qc, trim($join->table)), $join->on);
		}

		// build WHERE clause

		foreach($this->whereClauses as $where) {

			// complete condition when no operator set

			if(!$where->operator) {
				$w[] = $where->conditionOrColumn;
			}

			// otherwise parse operator

			else {
				if($where->operator === 'IN') {
					$w[] = sprintf(
						'%1$s%2$s%1$s IN (%3$s)',
						$qc,
						str_replace('.', $qc . '.' . $qc, $where->conditionOrColumn),
						implode(', ', array_fill(0, count($where->value), '?'))
					);
				}
				else {
					$w[] = sprintf(
						'%1$s%2$s%1$s %3$s ?',
						$qc,
						str_replace('.', $qc . '.' . $qc, $where->conditionOrColumn),
						$where->operator
					);
				}
			}
		}

		// build SORT clause

		foreach($this->columnSorts as $sort) {
			$s[] = $sort->column . ($sort->asc ? '' : ' DESC');
		}

		if(count($w)) {
			$this->sql .= ' WHERE (' . implode(') AND (', $w) .')';
		}
		if(count($s)) {
			$this->sql .= ' ORDER BY ' . implode(', ', $s);
		}

	}
498241
public function serializeToXml()
    {
        $xml = new \SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><BucketUserQos></BucketUserQos>');
        $xml->addChild('StorageCapacity', strval($this->storageCapacity));
        return $xml->asXML();
    }
377548
public String toPrettyString() {

        StringBuilder sb = recursiveToString(this, 0, indent, new StringBuilder());
        sb.insert(0, XML_DOCTYPE + "\n");

        return new String(sb);
    }