From 2716a63905d58e1c90feb8cdb027570f1eac377b Mon Sep 17 00:00:00 2001 From: Christoph Michael Becker Date: Sun, 20 Sep 2020 16:39:23 +0000 Subject: [PATCH] Add example for intermixing sub-elements and attributes This integrates user notes 103498 and 119937. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@350605 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../functions/xmlwriter-write-attribute.xml | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/reference/xmlwriter/functions/xmlwriter-write-attribute.xml b/reference/xmlwriter/functions/xmlwriter-write-attribute.xml index f1944a12ea..48e0ea048f 100644 --- a/reference/xmlwriter/functions/xmlwriter-write-attribute.xml +++ b/reference/xmlwriter/functions/xmlwriter-write-attribute.xml @@ -58,6 +58,40 @@ + + &reftitle.examples; + + Intermixing Sub-elements and Attributes + + If writing sub-elements and attributes is intermixed, any attempt to write + attributes after the first sub-element will fail and return false. + + +openMemory(); + +$xml->startElement('element'); +$xml->writeAttribute('attr1', '0'); +$xml->writeElement('subelem', '0'); +var_dump($xml->writeAttribute('attr2', '0')); +$xml->endElement(); + +echo $xml->flush(); +?> +]]> + + &example.outputs; + +0 +]]> + + + + &reftitle.seealso;