Convert Project to POM XML

@return String
@throws ProjectException exception
335158
public String toXml() throws ProjectException {
        log.debug("Writing xml");

        Project copy = this;
        copy.removeProperty( "project.basedir" );

        StringWriter writer = new StringWriter();

        MavenXpp3Writer pomWriter = new MavenXpp3Writer();
        try {
            pomWriter.write(writer, copy.mavenModel);
        } catch (IOException e) {
            throw new ProjectException("Failed to create pom xml", e);
        }

        writer.flush();
        return writer.toString();
    }
1124355
private function propertiesToXml() {
        $properties = array();

        foreach (self::$properties[get_class($this)] as $name => $info) {
            if($info['attribute']) {
                continue;
            }

            if (!array_key_exists($name, $this->values)) {
                continue;
            }

            $value = $this->values[$name];

            if(!array_key_exists('elementName', $info) && !array_key_exists('attributeName', $info)) {
                $properties[] = self::encodeValueXml($value);
            }
            else {
                if ($info['unbound']) {
                    foreach($value as $property) {
                        $properties[] = self::propertyToXml($info['elementName'], $property);
                    }
                } else {
                    $properties[] = self::propertyToXml($info['elementName'], $value);
                }
            }
        }

        return join('', $properties);
    }
634045
protected function buildXml()
    {
        if (empty($_POST['CKFinderCommand']) || $_POST['CKFinderCommand'] != 'true') {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
        }

        $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
        if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FOLDER_CREATE)) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
        }

        $_resourceTypeConfig = $this->_currentFolder->getResourceTypeConfig();
        $sNewFolderName = isset($_GET["NewFolderName"]) ? $_GET["NewFolderName"] : "";
        $sNewFolderName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($sNewFolderName);
        if ($_config->forceAscii()) {
            $sNewFolderName = CKFinder_Connector_Utils_FileSystem::convertToAscii($sNewFolderName);
        }

        if (!CKFinder_Connector_Utils_FileSystem::checkFolderName($sNewFolderName) || $_resourceTypeConfig->checkIsHiddenFolder($sNewFolderName)) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
        }

        $sServerDir = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $sNewFolderName);
        if (!is_writeable($this->_currentFolder->getServerPath())) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
        }

        $bCreated = false;

        if (file_exists($sServerDir)) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ALREADY_EXIST);
        }

        if ($perms = $_config->getChmodFolders()) {
            $oldUmask = umask(0);
            $bCreated = @mkdir($sServerDir, $perms);
            umask($oldUmask);
        }
        else {
            $bCreated = @mkdir($sServerDir);
        }

        if (!$bCreated) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
        } else {
            $oNewFolderNode = new Ckfinder_Connector_Utils_XmlNode("NewFolder");
            $this->_connectorNode->addChild($oNewFolderNode);
            $oNewFolderNode->addAttribute("name", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($sNewFolderName));
        }
    }
1238584
public String toXML() {
        StringBuilder sb = new StringBuilder();
        sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
        toXML(sb, 0);
        return sb.toString();
    }
1353415
function to_xml(){
		if ($this->skip) return false;
		
		$data = array(
			'id' => $this->get_id()
		);
		for ($i=0; $i<sizeof($this->config->text); $i++){
			$extra = $this->config->text[$i]["name"];
			$data[$extra]=$this->data[$extra];
			if (is_null($data[$extra]))
			    $data[$extra] = "";
		}

		if ($this->userdata !== false)
			foreach ($this->userdata as $key => $value){
				if ($value === null)
					$data[$key]="";
				$data[$key]=$value;
			}

		return $data;
	}
113631
public static function translatePath(Project $project, $source)
    {
        $result = [];
        if ($source == null) {
            return "";
        }

        $tok = new PathTokenizer($source);
        while ($tok->hasMoreTokens()) {
            $pathElement = $tok->nextToken();
            try {
                $element = self::resolveFile($project, $pathElement);
                for ($i = 0, $_i = strlen($element); $i < $_i; $i++) {
                    self::translateFileSep($element, $i);
                }
                $result[] = $element;
            } catch (BuildException $e) {
                $project->log(
                    "Dropping path element " . $pathElement
                    . " as it is not valid relative to the project",
                    Project::MSG_VERBOSE
                );
            }
        }

        return $result;
    }
327098
public function getGeneratedXML()
    {

        $dom = new XmlDomConstruct('1.0', 'utf-8');
        $dom->fromMixed(array(
            'request' => $this->_args
        ));
        $post_data = $dom->saveXML();
        $post_data = str_replace('<request/>', '<request method="' . $this->_method . '" />', $post_data);
        $post_data = str_replace('<request>', '<request method="' . $this->_method . '">', $post_data);

        return $post_data;

    }
851527
public function to_xml() {
        $this->validate();
        foreach ($this->entries as $entry) {
            $entry->id = 'portfolio:' . $entry->id;
            $this->feed->appendChild($entry->to_dom($this->dom, $this->user));
        }
        return $this->dom->saveXML();
    }
39593
def to_xml(self):
        """"""
        changesXML = ""
        for change in self.changes:
            changeParams = {"action": change[0], "record": change[1].to_xml()}
            changesXML += self.ChangeXML % changeParams
        params = {"comment": self.comment, "changes": changesXML}
        return self.ChangeResourceRecordSetsBody % params
1169364
public String toXML()
    {
        String eol = System.getProperty("line.separator");
        RepositoryTags tags = RepositoryTags.getInstance();

        // The result
        String result = "     ";

        switch (this.fieldSource)
        {
            case SOURCE_FIELD :
                result += " " + tags.getOpeningTagNonClosingById(RUNTIME_ARGUMENT);
                result += " " + tags.getAttribute(FIELD_REF, this.fieldRefName);
                result += " " + tags.getAttribute(RETURN, String.valueOf(this.returnedByProcedure));
                result += "/>";
                break;
            case SOURCE_VALUE :
                result += " " + tags.getOpeningTagNonClosingById(CONSTANT_ARGUMENT);
                result += " " + tags.getAttribute(VALUE, this.constantValue);
                result += "/>";
                break;
            case SOURCE_NULL :
                result += " " + tags.getOpeningTagNonClosingById(RUNTIME_ARGUMENT);
                result += "/>";
                break;
            default :
                break;
        }

        // Return the result.
        return (result + eol);
    }
486960
public function read()
    {
        $old    = libxml_use_internal_errors(true);
        $xml    = simplexml_load_file($this->path);
        $errors = libxml_get_errors();
        libxml_use_internal_errors($old);

        if (count($errors)) {
            throw new \RuntimeException('xml file \''. $this->path . '\': ' . $errors[0]->message);
        }
        return $xml;
    }
1028706
public function serializeToXml()
    {
        $xml = new \SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><BucketLoggingStatus></BucketLoggingStatus>');
        if (isset($this->targetBucket) && isset($this->targetPrefix)) {
            $loggingEnabled = $xml->addChild('LoggingEnabled');
            $loggingEnabled->addChild('TargetBucket', $this->targetBucket);
            $loggingEnabled->addChild('TargetPrefix', $this->targetPrefix);
        }
        return $xml->asXML();
    }
1245756
public function asXml() {
		$exception = $this->_exception;
		$options   = $this->_options;
		$builder   = new Errbit_XmlBuilder();
		$self      = $this;

		return $builder->tag(
			'notice',
			array('version' => Errbit::API_VERSION),
			function($notice) use ($exception, $options, $self) {
				$notice->tag('api-key',  $options['api_key']);
				$notice->tag('notifier', function($notifier) {
					$notifier->tag('name',    Errbit::PROJECT_NAME);
					$notifier->tag('version', Errbit::VERSION);
					$notifier->tag('url',     Errbit::PROJECT_URL);
				});

				$notice->tag('error', function($error) use ($exception, $self) {
					$klass = Errbit_Notice::className($exception);
					$error->tag('class',     $self->filterTrace($klass));
					$error->tag('message',   $self->filterTrace(sprintf('%s: %s', $klass, $exception->getMessage())));
					$error->tag('backtrace', function($backtrace) use ($exception, $self) {
						$trace = $exception->getTrace();

						$file1 = $exception->getFile();
						$backtrace->tag('line', array(
							'number' => $exception->getLine(),
							'file' => !empty($file1) ? $self->filterTrace($file1) : '<unknown>',
							'method' =>  "<unknown>"
						));

						// if there is no trace we should add an empty element
						if (empty($trace)) {
							$backtrace->tag(
								'line',
								array(
									 'number' => '',
									 'file' => '',
									 'method' => ''
								)
							);
						} else {
							foreach ($trace as $frame) {
								$backtrace->tag(
									'line',
									array(
										'number' => isset($frame['line']) ? $frame['line'] : 0,
										'file'   => isset($frame['file']) ? $self->filterTrace($frame['file']) : '<unknown>',
										'method' => $self->filterTrace(Errbit_Notice::formatMethod($frame))
									)
								);
							}
						}
					});
				});

				if (!empty($options['url'])
					|| !empty($options['controller'])
					|| !empty($options['action'])
					|| !empty($options['parameters'])
					|| !empty($options['session_data'])
					|| !empty($options['cgi_data'])) {
					$notice->tag('request', function($request) use ($options) {
						$request->tag('url',       !empty($options['url']) ? $options['url'] : '');
						$request->tag('component', !empty($options['controller']) ? $options['controller'] : '');
						$request->tag('action',    !empty($options['action']) ? $options['action'] : '');
						if (!empty($options['parameters'])) {
							$request->tag('params', function($params) use ($options) {
								Errbit_Notice::xmlVarsFor($params, $options['parameters']);
							});
						}

						if (!empty($options['session_data'])) {
							$request->tag('session', function($session) use ($options) {
								Errbit_Notice::xmlVarsFor($session, $options['session_data']);
							});
						}

						if (!empty($options['cgi_data'])) {
							$request->tag('cgi-data', function($cgiData) use ($options) {
								Errbit_Notice::xmlVarsFor($cgiData, $options['cgi_data']);
							});
						}
					});
				}

				$notice->tag('server-environment', function($env) use ($options) {
					$env->tag('project-root',     $options['project_root']);
					$env->tag('environment-name', $options['environment_name']);
					$env->tag('hostname',         $options['hostname']);
				});
			}
		)->asXml();
	}
110680
public function toXML(DOMElement $parent, string $name) : DOMElement
    {
        $e = $parent->ownerDocument->createElementNS(Constants::NS_MD, $name);
        $parent->appendChild($e);

        if (empty($this->Binding)) {
            throw new \Exception('Cannot convert endpoint to XML without a Binding set.');
        }
        if (empty($this->Location)) {
            throw new \Exception('Cannot convert endpoint to XML without a Location set.');
        }

        $e->setAttribute('Binding', $this->Binding);
        $e->setAttribute('Location', $this->Location);

        if ($this->ResponseLocation !== null) {
            $e->setAttribute('ResponseLocation', $this->ResponseLocation);
        }

        foreach ($this->attributes as $a) {
            $e->setAttributeNS($a['namespaceURI'], $a['qualifiedName'], $a['value']);
        }

        return $e;
    }
720729
protected function getRequestXml()
    {
        $serviceXmlNode = "<" . $this->getServiceName() . "/>";
        $xml = new \SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?>' . $serviceXmlNode);
        $xml->addAttribute('version', $this->getServiceVersion());

        $bodyChild = $xml->addChild('body');
        $bodyChild->addAttribute('merchantId', $this->getMerchantId());

        $transactionChild = $bodyChild->addChild('transaction');
        $transactionChild->addAttribute('refno', $this->getTransactionId());

        $requestChild = $transactionChild->addChild('request');

        $this->prepareRequestXml($requestChild);

        $requestChild->addChild('sign', $this->getSign());

        return $xml;
    }
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;
    }
557412
public function getXml(): string
    {
        $suites = $this->interpreter->flattenCases();
        $root = $this->getSuiteRoot($suites);
        foreach ($suites as $suite) {
            $snode = $this->appendSuite($root, $suite);
            foreach ($suite->cases as $case) {
                $cnode = $this->appendCase($snode, $case);
            }
        }

        return $this->document->saveXML();
    }