- $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;
+ $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();