class XMLWriter (View source)

Methods

bool
openUri(string $uri)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create new xmlwriter using source uri for output

bool
openMemory()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create new xmlwriter using memory for string output

bool
setIndent(bool|int $enable)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Toggle indentation on/off.

bool
setIndentString(string $indentation)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Set string used for indenting.

bool
startComment()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 1.0.0)
Create start comment

bool
endComment()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 1.0.0)
Create end comment

bool
startAttribute(string $name)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create start attribute

bool
endAttribute()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
End attribute

bool
writeAttribute(string $name, string $value)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Write full attribute

bool
startAttributeNs(string|null $prefix, string $name, string $namespace)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create start namespaced attribute

bool
writeAttributeNs(string|null $prefix, string $name, string $namespace, string $value)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Write full namespaced attribute

bool
startElement(string $name)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create start element tag

bool
endElement()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
End current element

bool
fullEndElement()

(PHP 5 >= 5.2.0, PECL xmlwriter >= 2.0.4)
End current element

bool
startElementNs(string|null $prefix, string $name, string $namespace)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create start namespaced element tag

bool
writeElement(string $name, string $content = null)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Write full element tag

bool
writeElementNs(string|null $prefix, string $name, string $namespace, string $content = null)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Write full namespaced element tag

bool
startPi(string $target)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create start PI tag

bool
endPi()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
End current PI

bool
writePi(string $target, string $content)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Writes a PI

bool
startCdata()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create start CDATA tag

bool
endCdata()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
End current CDATA

bool
writeCdata(string $content)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Write full CDATA tag

bool
text(string $content)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Write text

bool
writeRaw(string $content)

(PHP 5 >= 5.2.0, PECL xmlwriter >= 2.0.4)
Write a raw XML text

bool
startDocument(string $version = '1.0', string $encoding = null, string $standalone = null)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create document tag

bool
endDocument()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
End current document

bool
writeComment(string $content)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Write full comment tag

bool
startDtd(string $qualifiedName, string $publicId = null, string $systemId = null)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create start DTD tag

bool
endDtd()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
End current DTD

bool
writeDtd(string $name, string $publicId = null, string $systemId = null, string $content = null)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Write full DTD tag

bool
startDtdElement(string $qualifiedName)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create start DTD element

bool
endDtdElement()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
End current DTD element

bool
writeDtdElement(string $name, string $content)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Write full DTD element tag

bool
startDtdAttlist(string $name)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create start DTD AttList

bool
endDtdAttlist()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
End current DTD AttList

bool
writeDtdAttlist(string $name, string $content)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Write full DTD AttList tag

bool
startDtdEntity(string $name, bool $isParam)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create start DTD Entity

bool
endDtdEntity()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
End current DTD Entity

bool
writeDtdEntity(string $name, string $content, bool $pe, string $pubid, string $sysid, string $ndataid)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Write full DTD Entity tag

string
outputMemory(bool $flush = true)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Returns current buffer

string|int
flush(bool $empty = true)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 1.0.0)
Flush current buffer

static XMLWriter
toUri(string $uri)

No description

static XMLWriter
toMemory()

No description

static XMLWriter
toStream($stream)

No description

Details

bool openUri(string $uri)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create new xmlwriter using source uri for output

Parameters

string $uri

The URI of the resource for the output.

Return Value

bool

Object oriented style: Returns TRUE on success or FALSE on failure.

Procedural style: Returns a new xmlwriter resource for later use with the xmlwriter functions on success, FALSE on error.

bool openMemory()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create new xmlwriter using memory for string output

Return Value

bool

Object oriented style: Returns TRUE on success or FALSE on failure.

Procedural style: Returns a new xmlwriter resource for later use with the xmlwriter functions on success, FALSE on error.

bool setIndent(bool|int $enable)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Toggle indentation on/off.

Parameters

bool|int $enable

Whether indentation is enabled or number of indent strings

Return Value

bool

TRUE on success or FALSE on failure.

bool setIndentString(string $indentation)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Set string used for indenting.

Parameters

string $indentation

The indentation string.

Return Value

bool

TRUE on success or FALSE on failure.

bool startComment()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 1.0.0)
Create start comment

Return Value

bool

TRUE on success or FALSE on failure.

bool endComment()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 1.0.0)
Create end comment

Return Value

bool

TRUE on success or FALSE on failure.

bool startAttribute(string $name)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create start attribute

Parameters

string $name

The attribute name.

Return Value

bool

TRUE on success or FALSE on failure.

bool endAttribute()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
End attribute

Return Value

bool

TRUE on success or FALSE on failure.

bool writeAttribute(string $name, string $value)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Write full attribute

Parameters

string $name

The name of the attribute.

string $value

The value of the attribute.

Return Value

bool

TRUE on success or FALSE on failure.

bool startAttributeNs(string|null $prefix, string $name, string $namespace)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create start namespaced attribute

Parameters

string|null $prefix

The namespace prefix.

string $name

The attribute name.

string $namespace

The namespace URI.

Return Value

bool

TRUE on success or FALSE on failure.

bool writeAttributeNs(string|null $prefix, string $name, string $namespace, string $value)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Write full namespaced attribute

Parameters

string|null $prefix

The namespace prefix.

string $name

The attribute name.

string $namespace

The namespace URI.

string $value

The attribute value.

Return Value

bool

TRUE on success or FALSE on failure.

bool startElement(string $name)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create start element tag

Parameters

string $name

The element name.

Return Value

bool

TRUE on success or FALSE on failure.

bool endElement()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
End current element

Return Value

bool

TRUE on success or FALSE on failure.

bool fullEndElement()

(PHP 5 >= 5.2.0, PECL xmlwriter >= 2.0.4)
End current element

Return Value

bool

TRUE on success or FALSE on failure.

bool startElementNs(string|null $prefix, string $name, string $namespace)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create start namespaced element tag

Parameters

string|null $prefix

The namespace prefix.

string $name

The element name.

string $namespace

The namespace URI.

Return Value

bool

TRUE on success or FALSE on failure.

bool writeElement(string $name, string $content = null)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Write full element tag

Parameters

string $name

The element name.

string $content

[optional]

The element contents.

Return Value

bool

TRUE on success or FALSE on failure.

bool writeElementNs(string|null $prefix, string $name, string $namespace, string $content = null)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Write full namespaced element tag

Parameters

string|null $prefix

The namespace prefix.

string $name

The element name.

string $namespace

The namespace URI.

string $content

[optional]

The element contents.

Return Value

bool

TRUE on success or FALSE on failure.

bool startPi(string $target)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create start PI tag

Parameters

string $target

The target of the processing instruction.

Return Value

bool

TRUE on success or FALSE on failure.

bool endPi()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
End current PI

Return Value

bool

TRUE on success or FALSE on failure.

bool writePi(string $target, string $content)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Writes a PI

Parameters

string $target

The target of the processing instruction.

string $content

The content of the processing instruction.

Return Value

bool

TRUE on success or FALSE on failure.

bool startCdata()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create start CDATA tag

Return Value

bool

TRUE on success or FALSE on failure.

bool endCdata()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
End current CDATA

Return Value

bool

TRUE on success or FALSE on failure.

bool writeCdata(string $content)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Write full CDATA tag

Parameters

string $content

The contents of the CDATA.

Return Value

bool

TRUE on success or FALSE on failure.

bool text(string $content)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Write text

Parameters

string $content

The contents of the text.

Return Value

bool

TRUE on success or FALSE on failure.

bool writeRaw(string $content)

(PHP 5 >= 5.2.0, PECL xmlwriter >= 2.0.4)
Write a raw XML text

Parameters

string $content

The text string to write.

Return Value

bool

TRUE on success or FALSE on failure.

bool startDocument(string $version = '1.0', string $encoding = null, string $standalone = null)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create document tag

Parameters

string $version

[optional]

The version number of the document as part of the XML declaration.

string $encoding

[optional]

The encoding of the document as part of the XML declaration.

string $standalone

[optional]

yes or no.

Return Value

bool

TRUE on success or FALSE on failure.

bool endDocument()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
End current document

Return Value

bool

TRUE on success or FALSE on failure.

bool writeComment(string $content)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Write full comment tag

Parameters

string $content

The contents of the comment.

Return Value

bool

TRUE on success or FALSE on failure.

bool startDtd(string $qualifiedName, string $publicId = null, string $systemId = null)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create start DTD tag

Parameters

string $qualifiedName

The qualified name of the document type to create.

string $publicId

[optional]

The external subset public identifier.

string $systemId

[optional]

The external subset system identifier.

Return Value

bool

TRUE on success or FALSE on failure.

bool endDtd()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
End current DTD

Return Value

bool

TRUE on success or FALSE on failure.

bool writeDtd(string $name, string $publicId = null, string $systemId = null, string $content = null)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Write full DTD tag

Parameters

string $name

The DTD name.

string $publicId

[optional]

The external subset public identifier.

string $systemId

[optional]

The external subset system identifier.

string $content

[optional]

The content of the DTD.

Return Value

bool

TRUE on success or FALSE on failure.

bool startDtdElement(string $qualifiedName)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create start DTD element

Parameters

string $qualifiedName

The qualified name of the document type to create.

Return Value

bool

TRUE on success or FALSE on failure.

bool endDtdElement()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
End current DTD element

Return Value

bool

TRUE on success or FALSE on failure.

bool writeDtdElement(string $name, string $content)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Write full DTD element tag

Parameters

string $name

The name of the DTD element.

string $content

The content of the element.

Return Value

bool

TRUE on success or FALSE on failure.

bool startDtdAttlist(string $name)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create start DTD AttList

Parameters

string $name

The attribute list name.

Return Value

bool

TRUE on success or FALSE on failure.

bool endDtdAttlist()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
End current DTD AttList

Return Value

bool

TRUE on success or FALSE on failure.

bool writeDtdAttlist(string $name, string $content)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Write full DTD AttList tag

Parameters

string $name

The name of the DTD attribute list.

string $content

The content of the DTD attribute list.

Return Value

bool

TRUE on success or FALSE on failure.

bool startDtdEntity(string $name, bool $isParam)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Create start DTD Entity

Parameters

string $name

The name of the entity.

bool $isParam

Return Value

bool

TRUE on success or FALSE on failure.

bool endDtdEntity()

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
End current DTD Entity

Return Value

bool

TRUE on success or FALSE on failure.

bool writeDtdEntity(string $name, string $content, bool $pe, string $pubid, string $sysid, string $ndataid)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Write full DTD Entity tag

Parameters

string $name

The name of the entity.

string $content

The content of the entity.

bool $pe
string $pubid
string $sysid
string $ndataid

Return Value

bool

TRUE on success or FALSE on failure.

string outputMemory(bool $flush = true)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
Returns current buffer

Parameters

bool $flush

[optional]

Whether to flush the output buffer or not. Default is TRUE.

Return Value

string

the current buffer as a string.

string|int flush(bool $empty = true)

(PHP 5 >= 5.1.2, PECL xmlwriter >= 1.0.0)
Flush current buffer

Parameters

bool $empty

[optional]

Whether to empty the buffer or not. Default is TRUE.

Return Value

string|int

If you opened the writer in memory, this function returns the generated XML buffer, Else, if using URI, this function will write the buffer and return the number of written bytes.

static XMLWriter toUri(string $uri)

Since: 8.4

No description

Parameters

string $uri

Return Value

XMLWriter

static XMLWriter toMemory()

Since: 8.4

No description

Return Value

XMLWriter

static XMLWriter toStream($stream)

Since: 8.4

No description

Parameters

$stream

Return Value

XMLWriter