- if (is_array($content)) {
- foreach ($content as $values) {
- OMB_Plain_XRDS_Writer::writeFullElement($xw, $values[0], $values[1], $values[2]);
- }
- } else {
- $xw->text($content);
+
+ /**
+ * Write a complex XML element
+ *
+ * Outputs a XML element with attributes and content.
+ *
+ * @param XMLWriter $xw The XMLWriter used to output the element
+ * @param string $tag The tag name
+ * @param array|null $attributes A map of XML attributes
+ * @param array|string $content The content of the element; either an
+ * array of child nodes each specified by a
+ * three entry-array ($tag, $attributes,
+ * $content) or a string
+ */
+ private function _writeFullElement($xw, $tag, $attributes, $content)
+ {
+ $xw->startElement($tag);
+ if (!is_null($attributes)) {
+ foreach ($attributes as $name => $value) {
+ $xw->writeAttribute($name, $value);
+ }
+ }
+ if (is_array($content)) {
+ foreach ($content as $val) {
+ $this->_writeFullElement($xw, $val[0], $val[1], $val[2]);
+ }
+ } else {
+ $xw->text($content);
+ }
+ $xw->fullEndElement();