src/XML/Util.php
function createTag($qname, $attributes = array(), $content = null, 
        $namespaceUri = null, $replaceEntities = XML_UTIL_REPLACE_ENTITIES, 
        $multiline = false, $indent = '_auto', $linebreak = "\n", 
        $sortAttributes = true)
    {
        $tag = array(
            'qname'      => $qname,
            'attributes' => $attributes
        );

        // add tag content
        if ($content !== null) {
            $tag['content'] = $content;
        }

        // add namespace Uri
        if ($namespaceUri !== null) {
            $tag['namespaceUri'] = $namespaceUri;
        }

        return XML_Util::createTagFromArray($tag, $replaceEntities, $multiline, 
            $indent, $linebreak, $sortAttributes);
    }
function createTag($qname, $attributes = array(), $content = null, 
        $namespaceUri = null, $replaceEntities = XML_UTIL_REPLACE_ENTITIES, 
        $multiline = false, $indent = '_auto', $linebreak = "\n", 
        $sortAttributes = true)
    {
        $tag = array(
            'qname'      => $qname,
            'attributes' => $attributes
        );

        // add tag content
        if ($content !== null) {
            $tag['content'] = $content;
        }

        // add namespace Uri
        if ($namespaceUri !== null) {
            $tag['namespaceUri'] = $namespaceUri;
        }

        return XML_Util::createTagFromArray($tag, $replaceEntities, $multiline, 
            $indent, $linebreak, $sortAttributes);
    }
create a tag

This method will call XML_Util::createTagFromArray(), which
is more flexible.

<code>
require_once 'XML/Util.php';

// create an XML tag:
$tag = XML_Util::createTag('myNs:myTag',
array('foo' => 'bar'),
'This is inside the tag',
'http://www.w3c.org/myNs#');
</code>

@param string $qname           qualified tagname (including namespace)
@param array  $attributes      array containg attributes
@param mixed  $content         the content
@param string $namespaceUri    URI of the namespace
@param int    $replaceEntities whether to replace XML special chars in
content, embedd it in a CData section
or none of both
@param bool   $multiline       whether to create a multiline tag where
each attribute gets written to a single line
@param string $indent          string used to indent attributes
(_auto indents attributes so they start
at the same column)
@param string $linebreak       string used for linebreaks
@param bool   $sortAttributes  Whether to sort the attributes or not

@return string XML tag
@access public
@static
@see createTagFromArray()
@uses createTagFromArray() to create the tag