11        $this->writer = 
new Writer();
 
   12        $this->writer->namespaceMap = [
 
   13            'http://sabredav.org/ns' => 
's',
 
   15        $this->writer->openMemory();
 
   16        $this->writer->setIndent(
true);
 
   17        $this->writer->startDocument();
 
   23        $this->writer->write(
$input);
 
   24        $this->assertEquals(
$output, $this->writer->outputMemory());
 
   32            '{http://sabredav.org/ns}root' => 
'text',
 
   35<s:root xmlns:s=
"http://sabredav.org/ns">text</s:root>
 
   48            '{http://sabredav.org/ns}root' => 
'"text"',
 
   51<s:root xmlns:s=
"http://sabredav.org/ns">"text"</s:root>
 
   61            '{http://sabredav.org/ns}root' => [
 
   64                    'attr1' => 
'attribute value',
 
   69<s:root xmlns:s=
"http://sabredav.org/ns" attr1=
"attribute value">text</s:root>
 
   77            '{http://sabredav.org/ns}root' => [
 
   78                '{http://sabredav.org/ns}single'   => 
'value',
 
   79                '{http://sabredav.org/ns}multiple' => [
 
   81                        'name'  => 
'{http://sabredav.org/ns}foo',
 
   85                        'name'  => 
'{http://sabredav.org/ns}foo',
 
   90                    'name'       => 
'{http://sabredav.org/ns}attributes',
 
   97                    'name'       => 
'{http://sabredav.org/ns}verbose',
 
  106<s:root xmlns:s=
"http://sabredav.org/ns">
 
  107 <s:single>value</s:single>
 
  110  <s:foo>foobar</s:foo>
 
  112 <s:attributes foo=
"bar"/>
 
  113 <s:verbose foo=
"bar">syntax</s:verbose>
 
  123            '{http://sabredav.org/ns}root' => 
null,
 
  126<s:root xmlns:s=
"http://sabredav.org/ns"/>
 
  136            '{http://sabredav.org/ns}root' => [
 
  138                    'name'       => 
'{http://sabredav.org/ns}elem1',
 
  141                        'attr1' => 
'attribute value',
 
  147<s:root xmlns:s=
"http://sabredav.org/ns">
 
  148 <s:elem1 attr1=
"attribute value">text</s:elem1>
 
  159            '{http://sabredav.org/ns}root' => [
 
  161                    'name'  => 
'{http://sabredav.org/ns}elem1',
 
  171<s:root xmlns:s=
"http://sabredav.org/ns">
 
  172 <s:elem1>foobarbaz</s:elem1>
 
  186            '{http://sabredav.org/ns}root' => [
 
  188                    'name'       => 
'{http://sabredav.org/ns}elem1',
 
  190                        'attr1' => 
'attribute value',
 
  196<s:root xmlns:s=
"http://sabredav.org/ns">
 
  197 <s:elem1 attr1=
"attribute value"/>
 
  208            '{http://sabredav.org/ns}root' => [
 
  209                '{urn:foo}elem1' => 
'bar',
 
  213<s:root xmlns:s=
"http://sabredav.org/ns">
 
  214 <x1:elem1 xmlns:x1=
"urn:foo">bar</x1:elem1>
 
  226            '{http://sabredav.org/ns}root' => [
 
  231<s:root xmlns:s=
"http://sabredav.org/ns">
 
  232 <elem1 xmlns=
"">bar</elem1>
 
  243            '{http://sabredav.org/ns}root' => [
 
  245                    'name'       => 
'{http://sabredav.org/ns}elem1',
 
  249                        '{http://sabredav.org/ns}attr2' => 
'val2',
 
  250                        '{urn:foo}attr3'                => 
'val3',
 
  256<s:root xmlns:s=
"http://sabredav.org/ns">
 
  257 <s:elem1 attr1=
"val1" s:attr2=
"val2" x1:attr3=
"val3" xmlns:x1=
"urn:foo">text</s:elem1>
 
  268            '{http://sabredav.org/ns}root' => 
new Element\
Base(
'hello')
 
  271<s:root xmlns:s=
"http://sabredav.org/ns">hello</s:root>
 
  281            '{http://sabredav.org/ns}root' => 
new Element\Mock()
 
  284<s:root xmlns:s=
"http://sabredav.org/ns">
 
  285 <s:elem1>hiiii!</s:elem1>
 
  295        $this->writer->namespaceMap[
'http://sabredav.org/ns'] = 
null;
 
  297            '{http://sabredav.org/ns}root' => 
new Element\Mock()
 
  300<root xmlns=
"http://sabredav.org/ns">
 
  301 <elem1>hiiii!</elem1>
 
  311        $this->writer->namespaceMap[
'http://sabredav.org/ns'] = 
'';
 
  313            '{http://sabredav.org/ns}root' => 
new Element\Mock()
 
  316<root xmlns=
"http://sabredav.org/ns">
 
  317 <elem1>hiiii!</elem1>
 
  327        $this->writer->writeElement(
"{http://sabredav.org/ns}foo", 
'content');
 
  331<s:foo xmlns:s=
"http://sabredav.org/ns">content</s:foo>
 
  335        $this->assertEquals(
$output, $this->writer->outputMemory());
 
  342        $this->writer->writeElement(
"{http://sabredav.org/ns}foo", 
new Element\KeyValue([
'{http://sabredav.org/ns}bar' => 
'test']));
 
  346<s:foo xmlns:s=
"http://sabredav.org/ns">
 
  352        $this->assertEquals(
$output, $this->writer->outputMemory());
 
  361        $this->writer->write(
new \StdClass());
 
  367        $this->writer->startElement(
"foo");
 
  368        $this->writer->endElement();
 
  372<foo xmlns:s=
"http://sabredav.org/ns"/>
 
  376        $this->assertEquals(
$output, $this->writer->outputMemory());
 
  384                $writer->text(
'deferred writer');
 
  388<s:root xmlns:s=
"http://sabredav.org/ns">deferred writer</s:root>
 
  401            '{http://sabredav.org/ns}root' => fopen(
'php://memory', 
'r'),
 
  404<s:root xmlns:s=
"http://sabredav.org/ns">deferred writer</s:root>
 
  418        $this->writer->classMap[
'stdClass'] = 
function(
Writer $writer, $value) {
 
  420            foreach (get_object_vars($value) as 
$key => $val) {
 
  421                $writer->writeElement(
'{http://sabredav.org/ns}' . 
$key, $val);
 
  427            '{http://sabredav.org/ns}root' => $obj
 
  430<s:root xmlns:s=
"http://sabredav.org/ns">
 
  431 <s:key1>value1</s:key1>
 
  432 <s:key2>value2</s:key2>
 
An exception for terminatinating execution or to throw for unit testing.
testResource()
@expectedException \InvalidArgumentException
testEmptyNamespacePrefixEmptyString()
testWriteBadObject()
@expectedException \InvalidArgumentException
testSimpleQuotes()
@depends testSimple
testArrayFormat2NoValue()
@depends testArrayFormat2
testEmptyNamespacePrefix()
testWriteElementComplex()
This is the XML element interface.
Base Class for all \phpseclib\Crypt* cipher classes.