public function toXML($env) { $xs = new XMLStringer(); $xs->startXML(); $xs->elementStart('me:env', array('xmlns:me' => MagicEnvelope::NS)); $xs->element('me:data', array('type' => $env['data_type']), $env['data']); $xs->element('me:encoding', null, $env['encoding']); $xs->element('me:alg', null, $env['alg']); $xs->element('me:sig', null, $env['sig']); $xs->elementEnd('me:env'); $string = $xs->getString(); common_debug($string); return $string; }
/** * Create an <me:env> XML representation of the envelope. * * @return string representation of XML document */ public function toXML() { $xs = new XMLStringer(); $xs->startXML(); $xs->elementStart('me:env', array('xmlns:me' => self::NS)); $xs->element('me:data', array('type' => $this->data_type), $this->data); $xs->element('me:encoding', null, $this->encoding); $xs->element('me:alg', null, $this->alg); $xs->element('me:sig', null, $this->getSignature()); $xs->elementEnd('me:env'); $string = $xs->getString(); return $string; }
/** * Create an <me:env> XML representation of the envelope. * * @return string representation of XML document */ public function toXML(Profile $target = null, $flavour = null) { $xs = new XMLStringer(); $xs->startXML(); // header, to point out it's not HTML or anything... if (Event::handle('StartMagicEnvelopeToXML', array($this, $xs, $flavour, $target))) { // fall back to our default, normal Magic Envelope XML. // the $xs element _may_ have had elements added, or could get in the end event $xs->elementStart('me:env', array('xmlns:me' => self::NS)); $xs->element('me:data', array('type' => $this->data_type), $this->data); $xs->element('me:encoding', null, $this->encoding); $xs->element('me:alg', null, $this->alg); $xs->element('me:sig', null, $this->getSignature()); $xs->elementEnd('me:env'); Event::handle('EndMagicEnvelopeToXML', array($this, $xs, $flavour, $target)); } return $xs->getString(); }
public function toXML() { $xs = new XMLStringer(); $xs->startXML(); $xs->elementStart('XRD', array('xmlns' => XRD::XRD_NS)); if ($this->host) { $xs->element('hm:Host', array('xmlns:hm' => XRD::HOST_META_NS), $this->host); } if ($this->expires) { $xs->element('Expires', null, $this->expires); } if ($this->subject) { $xs->element('Subject', null, $this->subject); } foreach ($this->alias as $alias) { $xs->element('Alias', null, $alias); } foreach ($this->links as $link) { $titles = array(); if (isset($link['title'])) { $titles = $link['title']; unset($link['title']); } $xs->elementStart('Link', $link); foreach ($titles as $title) { $xs->element('Title', null, $title); } $xs->elementEnd('Link'); } $xs->elementEnd('XRD'); return $xs->getString(); }