public function writeElement($name, $value, $prefix = null, $url = null) { if ($prefix !== null) { $this->cursor->writeElementNs($prefix, $name, $url, $value); } elseif ($this->needsCdataWrapping($value)) { $this->startElement($name, $prefix, $url); $this->cursor->writeCdata($value); $this->endElement(); } else { $this->cursor->writeElement($name, $value); } }
public function writeValue($value) { if ($this->needsCdataWrapping($value)) { $this->cursor->writeCdata($value); } else { $this->cursor->text($value); } }
function toXml(XmlWriter $x, $writeEnvelope = true) { if ($writeEnvelope) { $x->startElement('http-request'); } $x->startElement('method'); $x->text($this->getMethod()); $x->endElement(); $x->startElement('url'); $x->text($this->getUrl()); $x->endElement(); $x->startElement('headers'); foreach ($this->getHeaders() as $k => $v) { $x->startElement('header'); $x->writeAttribute('name', $k); $x->text($v); $x->endElement(); } $x->endElement(); $x->startElement('params'); foreach ($this->getPostParams() as $k => $v) { $x->startElement('param'); $x->writeAttribute('name', $k); $x->text($v); $x->endElement(); } $x->endElement(); if (!$this->getPostParams() && $this->getBody()) { $x->startElement('body'); $x->writeCdata($this->getBody()); $x->endElement(); } if ($writeEnvelope) { $x->endElement(); } }
private function writeCategory(\XmlWriter $writer, Category $category) { $writer->startElement('category'); if ($category->getDomain()) { $writer->writeAttribute('domain', $category->getDomain()); } $writer->writeCdata($category->getTitle()); $writer->endElement(); }
function toXml(XmlWriter $x) { $x->startElement('url'); $x->startElement('method'); $x->text($this->getMethod()); $x->endElement(); $x->startElement('scheme'); $x->text($this->getScheme()); $x->endElement(); $x->startElement('base_url'); $x->text($this->getBaseUrl(true)); $x->endElement(); $x->startElement('path_info'); $x->text($this->getPathInfo()); $x->endElement(); $x->startElement('host'); $x->text($this->getHttpHost()); $x->endElement(); $x->startElement('remote_addr'); $x->text($this->getClientIp(false)); $x->endElement(); $x->endElement(); $x->startElement('params'); foreach ($this->getRequestOnlyParams() as $k => $v) { $x->startElement('param'); $x->writeAttribute('name', $k); if (is_array($v) || is_object($v)) { $v = json_encode($v); $x->writeAttribute("serialized", "json"); $x->writeCdata($v); } else { $x->text($v); } $x->endElement(); } $x->endElement(); }