diff options
author | James Walker <walkah@walkah.net> | 2010-08-02 16:42:28 -0400 |
---|---|---|
committer | James Walker <walkah@walkah.net> | 2010-08-02 16:42:28 -0400 |
commit | 8120842780319089f47144acf82685163237b8bc (patch) | |
tree | 8e41a2679b45541a5531eb6f421eee2bb41a14d2 /plugins/OStatus/lib/magicenvelope.php | |
parent | 56294016a753c43c366bf4680da28a17cccc21d5 (diff) |
Fix for #2429 - move OStatus XML writing to XMLStringer
Diffstat (limited to 'plugins/OStatus/lib/magicenvelope.php')
-rw-r--r-- | plugins/OStatus/lib/magicenvelope.php | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/plugins/OStatus/lib/magicenvelope.php b/plugins/OStatus/lib/magicenvelope.php index f39686b71..3bdf24b31 100644 --- a/plugins/OStatus/lib/magicenvelope.php +++ b/plugins/OStatus/lib/magicenvelope.php @@ -97,24 +97,18 @@ class MagicEnvelope } public function toXML($env) { - $dom = new DOMDocument(); - - $envelope = $dom->createElementNS(MagicEnvelope::NS, 'me:env'); - $envelope->setAttribute('xmlns:me', MagicEnvelope::NS); - $data = $dom->createElementNS(MagicEnvelope::NS, 'me:data', $env['data']); - $data->setAttribute('type', $env['data_type']); - $envelope->appendChild($data); - $enc = $dom->createElementNS(MagicEnvelope::NS, 'me:encoding', $env['encoding']); - $envelope->appendChild($enc); - $alg = $dom->createElementNS(MagicEnvelope::NS, 'me:alg', $env['alg']); - $envelope->appendChild($alg); - $sig = $dom->createElementNS(MagicEnvelope::NS, 'me:sig', $env['sig']); - $envelope->appendChild($sig); - - $dom->appendChild($envelope); + $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'); - - return $dom->saveXML(); + $string = $xs->getString(); + common_debug($string); + return $string; } |