(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)

XMLWriter::startElement -- xmlwriter_start_elementCrea la etiqueta del elemento inicial


Estilo orientado a objetos

XMLWriter::startElement(string $name): bool

Estilo por procedimientos

xmlwriter_start_element(resource $xmlwriter, string $name): bool

Inicia un elemento.



Sólo para llamadas por procedimientos. El resource XMLWriter que está siendo modificado. Este recurso proviene de una llamada a xmlwriter_open_uri() o xmlwriter_open_memory().


El nombre del elemento.

Valores devueltos

Devuelve true en caso de éxito o false en caso de error.

Ver también

add a note add a note

User Contributed Notes 2 notes

toby at php dot net
12 years ago
Note that startElement() and startElementNS() naturally do not write the closing ">" of the tag, since you may add an arbitrary number of attributes after starting a tag.

However, in some cases you may want to have the starting element tag closed in the output buffer before writing any further elements or content (e.g. if you communicate via an XML stream). To achieve this, you can simply use the text() method with an empty string.
indy at driftsolutions dot com
4 years ago
I'm using PHP 7.1, not sure how many versions are affected but if you try to start an element that is a number or starts with a number (ie. 1 or 1TBS) it won't write it and messes up your XML.
To Top