OO_011.phpt 934 B

1234567891011121314151617181920212223242526272829303132333435
  1. --TEST--
  2. XMLWriter: libxml2 XML Writer, fullEndElement method
  3. --CREDITS--
  4. Mauricio Vieira <mauricio [at] @mauriciovieira [dot] net>
  5. #testfest PHPSP on 2014-07-05
  6. --EXTENSIONS--
  7. xmlwriter
  8. --FILE--
  9. <?php
  10. $xw = new XMLWriter();
  11. $xw->openMemory();
  12. $xw->setIndent(TRUE);
  13. $xw->setIndentString(' ');
  14. $xw->startDocument('1.0', "UTF-8");
  15. $xw->startElement('root');
  16. $xw->startElementNS('ns1', 'child1', 'urn:ns1');
  17. $xw->writeAttributeNS('ns1', 'att1', 'urn:ns1', '<>"\'&');
  18. $xw->writeElement('chars', "special characters: <>\"'&");
  19. $xw->endElement();
  20. $xw->startElement('empty');
  21. $xw->fullEndElement();
  22. $xw->fullEndElement();
  23. // Force to write and empty the buffer
  24. $output = $xw->flush(true);
  25. print $output;
  26. ?>
  27. --EXPECT--
  28. <?xml version="1.0" encoding="UTF-8"?>
  29. <root>
  30. <ns1:child1 ns1:att1="&lt;&gt;&quot;'&amp;" xmlns:ns1="urn:ns1">
  31. <chars>special characters: &lt;&gt;&quot;'&amp;</chars>
  32. </ns1:child1>
  33. <empty></empty>
  34. </root>