}
foreach ($this->categories as $cat) {
- $xs->raw($cat->asString());
+ $cat->outputTo($xs);
}
// can be either URLs or enclosure objects
}
if (!empty($this->poco)) {
- $xo->raw($this->poco->asString());
+ $this->poco->outputTo($xo);
}
foreach ($this->extra as $el) {
}
function asString()
+ {
+ $xs = new XMLStringer();
+ $this->outputTo($xs);
+ return $xs->getString();
+ }
+
+ function outputTo($xo)
{
$attribs = array();
if ($this->term !== null) {
if ($this->label !== null) {
$attribs['label'] = $this->label;
}
- $xs = new XMLStringer();
- $xs->element('category', $attribs);
- return $xs->getString();
+ $xo->element('category', $attribs);
}
}
function asString()
{
$xs = new XMLStringer(true);
- $xs->element(
+ $this->outputTo($xs);
+ return $xs->getString();
+ }
+
+ function outputTo($xo)
+ {
+ $xo->element(
'poco:preferredUsername',
null,
$this->preferredUsername
);
- $xs->element(
+ $xo->element(
'poco:displayName',
null,
$this->displayName
);
if (!empty($this->note)) {
- $xs->element('poco:note', null, common_xml_safe_str($this->note));
+ $xo->element('poco:note', null, common_xml_safe_str($this->note));
}
if (!empty($this->address)) {
- $xs->raw($this->address->asString());
+ $this->address->outputTo($xo);
}
foreach ($this->urls as $url) {
- $xs->raw($url->asString());
+ $url->outputTo($xo);
}
-
- return $xs->getString();
}
}
// @todo Other address fields
function asString()
+ {
+ $xs = new XMLStringer(true);
+ $this->outputTo($xs);
+ return $xs->getString();
+ }
+
+ function outputTo($xo)
{
if (!empty($this->formatted)) {
- $xs = new XMLStringer(true);
- $xs->elementStart('poco:address');
- $xs->element('poco:formatted', null, common_xml_safe_str($this->formatted));
- $xs->elementEnd('poco:address');
- return $xs->getString();
+ $xo->elementStart('poco:address');
+ $xo->element('poco:formatted', null, common_xml_safe_str($this->formatted));
+ $xo->elementEnd('poco:address');
}
-
- return null;
}
}
function asString()
{
$xs = new XMLStringer(true);
- $xs->elementStart('poco:urls');
- $xs->element('poco:type', null, $this->type);
- $xs->element('poco:value', null, $this->value);
+ $this->outputTo($xs);
+ return $xs->getString();
+ }
+
+ function outputTo($xo)
+ {
+ $xo->elementStart('poco:urls');
+ $xo->element('poco:type', null, $this->type);
+ $xo->element('poco:value', null, $this->value);
if (!empty($this->primary)) {
- $xs->element('poco:primary', null, 'true');
+ $xo->element('poco:primary', null, 'true');
}
- $xs->elementEnd('poco:urls');
- return $xs->getString();
+ $xo->elementEnd('poco:urls');
}
}