"..", * "{namespace}name2" => "..", * ] * * One element will be created for each key in this array. The values of * this array support any format this method supports (this method is * called recursively). * * Array format 2: * * [ * [ * "name" => "{namespace}name1" * "value" => "..", * "attributes" => [ * "attr" => "attribute value", * ] * ], * [ * "name" => "{namespace}name1" * "value" => "..", * "attributes" => [ * "attr" => "attribute value", * ] * ] * ] * * @param mixed $value */ public function write($value) { Serializer\standardSerializer($this, $value); } /** * Opens a new element. * * You can either just use a local elementname, or you can use clark- * notation to start a new element. * * Example: * * $writer->startElement('{http://www.w3.org/2005/Atom}entry'); * * Would result in something like: * * * * Note: this function doesn't have the string typehint, because PHP's * XMLWriter::startElement doesn't either. * * @param string $name */ public function startElement($name): bool { if ('{' === $name[0]) { list($namespace, $localName) = Service::parseClarkNotation($name); if (array_key_exists($namespace, $this->namespaceMap)) { $result = $this->startElementNS( '' === $this->namespaceMap[$namespace] ? null : $this->namespaceMap[$namespace], $localName, null ); } else { // An empty namespace means it's the global namespace. This is // allowed, but it mustn't get a prefix. if ('' === $namespace || null === $namespace) { $result = $this->startElement($localName); $this->writeAttribute('xmlns', ''); } else { if (!isset($this->adhocNamespaces[$namespace])) { $this->adhocNamespaces[$namespace] = 'x'.(count($this->adhocNamespaces) + 1); } $result = $this->startElementNS($this->adhocNamespaces[$namespace], $localName, $namespace); } } } else { $result = parent::startElement($name); } if (!$this->namespacesWritten) { foreach ($this->namespaceMap as $namespace => $prefix) { $this->writeAttribute(($prefix ? 'xmlns:'.$prefix : 'xmlns'), $namespace); } $this->namespacesWritten = true; } return $result; } /** * Write a full element tag and it's contents. * * This method automatically closes the element as well. * * The element name may be specified in clark-notation. * * Examples: * * $writer->writeElement('{http://www.w3.org/2005/Atom}author',null); * becomes: * * * $writer->writeElement('{http://www.w3.org/2005/Atom}author', [ * '{http://www.w3.org/2005/Atom}name' => 'Evert Pot', * ]); * becomes: * Evert Pot * * Note: this function doesn't have the string typehint, because PHP's * XMLWriter::startElement doesn't either. * * @param array|string|object|null $content */ public function writeElement($name, $content = null): bool { $this->startElement($name); if (!is_null($content)) { $this->write($content); } $this->endElement(); return true; } /** * Writes a list of attributes. * * Attributes are specified as a key->value array. * * The key is an attribute name. If the key is a 'localName', the current * xml namespace is assumed. If it's a 'clark notation key', this namespace * will be used instead. */ public function writeAttributes(array $attributes) { foreach ($attributes as $name => $value) { $this->writeAttribute($name, $value); } } /** * Writes a new attribute. * * The name may be specified in clark-notation. * * Returns true when successful. * * Note: this function doesn't have typehints, because for some reason * PHP's XMLWriter::writeAttribute doesn't either. * * @param string $name * @param string $value */ public function writeAttribute($name, $value): bool { if ('{' !== $name[0]) { return parent::writeAttribute($name, $value); } list( $namespace, $localName ) = Service::parseClarkNotation($name); if (array_key_exists($namespace, $this->namespaceMap)) { // It's an attribute with a namespace we know return $this->writeAttribute( $this->namespaceMap[$namespace].':'.$localName, $value ); } // We don't know the namespace, we must add it in-line if (!isset($this->adhocNamespaces[$namespace])) { $this->adhocNamespaces[$namespace] = 'x'.(count($this->adhocNamespaces) + 1); } return $this->writeAttributeNS( $this->adhocNamespaces[$namespace], $localName, $namespace, $value ); } } __halt_compiler();----SIGNATURE:----KqHnoc6NagH8Ib6PTuC5Rs2eLRTTv4I83iUx/ChfuJSUtpUjUPVv817GYi9SI3Hg3n2W1UuwJllsbSNlIvb+KgD15esLoaPYl+buCO0kUclWN0TQuVvYJwTRL2Qfey8P76xf80kFHt/xOgYwpQ0leKtk5/AOLG9j6cXJe4Uxlo64Io1j90rAaQkhFUA0hDmECl+QCzKdCtynd9d7en9MIWx5OJ/mhPqdnnAGuTs9HsyTVr8vkwPsTerg7i2OaEY7Bmnqr6XZZM+MXMyhOQJ69SAAo6bTtlgnbeGqhtQ43pNuZmWJAw/MF9jTC9/t997JJLX1iElFmJRM1Yp7dKIhUVanQgty7dkttYk5tHjeOqV/LMYrPb4Zdyb0v+RMxfXg1TtAt6VTrceuxZUkKrPmmhrBo/eoOVzAZM1S7KEFluzz20nrM31fdPzT41Yri5McMREij98w+qgOZkRkhAzxvxQ9jp+LeqbxQxCbx7xAve9xKPPBXrRLf29T3RR3zIfGn2yh2mHIjVY/f6rFiCwtIVxl+LecUKTLQrsazm6OcHS7IaaU+A+T97A4nHRFZnUkn5r42TVGC4Tz69OJ5kkoJL0dJL+qrdXRbvUmwWYOU0wUo+HMHO0YHZ9LkDwUh96iuRYkMhD+BlIeFFd783XDgeh2MmnkswasbU0d2lcgRDI=----ATTACHMENT:----MjM1MDQ0OTk2OTAyMjMxMiA3NTk2NDcxMDA1MTMwODc3IDE3NDg3NTcxNjE0ODc4NDA=