Namespaced elements now available in xmloutputter
This commit is contained in:
parent
8056097478
commit
a3ded586b6
@ -142,6 +142,15 @@ class XMLOutputter
|
||||
$this->elementEnd($tag);
|
||||
}
|
||||
|
||||
function elementNS(array $ns, $tag, $attrs=null, $content=null)
|
||||
{
|
||||
$this->elementStartNS($ns, $tag, $attrs);
|
||||
if (!is_null($content)) {
|
||||
$this->xw->text($content);
|
||||
}
|
||||
$this->elementEnd($tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* output a start tag for an element
|
||||
*
|
||||
@ -169,6 +178,20 @@ class XMLOutputter
|
||||
}
|
||||
}
|
||||
|
||||
function elementStartNS(array $ns, $tag, $attrs=null)
|
||||
{
|
||||
reset($ns); // array pointer to 0
|
||||
$uri = key($ns);
|
||||
$this->xw->startElementNS($ns[$uri], $tag, $uri);
|
||||
if (is_array($attrs)) {
|
||||
foreach ($attrs as $name => $value) {
|
||||
$this->xw->writeAttribute($name, $value);
|
||||
}
|
||||
} else if (is_string($attrs)) {
|
||||
$this->xw->writeAttribute('class', $attrs);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* output an end tag for an element
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user