important: XMLWriter expects UTF-8 data from you. It can output xml in various encodings, but input should be strictly utf-8!| CARVIEW |
Select Language
HTTP/2 301
server: myracloud
date: Fri, 26 Dec 2025 17:46:11 GMT
content-type: text/html
content-length: 161
location: https://www.php.net/xmlwriter
HTTP/2 200
server: myracloud
date: Fri, 26 Dec 2025 17:46:11 GMT
content-type: text/html; charset=utf-8
content-language: en
permissions-policy: interest-cohort=()
x-frame-options: SAMEORIGIN
status: 200 OK
link: ; rel=shorturl
last-modified: Fri, 26 Dec 2025 16:08:52 GMT
vary: accept-encoding
content-encoding: gzip
expires: Fri, 26 Dec 2025 17:46:11 GMT
cache-control: max-age=0
PHP: XMLWriter - Manual
update page now
XMLWriter
- Introduction
- Installing/Configuring
- Examples
- XMLWriter — The XMLWriter class
- XMLWriter::endAttribute — End attribute
- XMLWriter::endCdata — End current CDATA
- XMLWriter::endComment — Create end comment
- XMLWriter::endDocument — End current document
- XMLWriter::endDtd — End current DTD
- XMLWriter::endDtdAttlist — End current DTD AttList
- XMLWriter::endDtdElement — End current DTD element
- XMLWriter::endDtdEntity — End current DTD Entity
- XMLWriter::endElement — End current element
- XMLWriter::endPi — End current PI
- XMLWriter::flush — Flush current buffer
- XMLWriter::fullEndElement — End current element
- XMLWriter::openMemory — Create new xmlwriter using memory for string output
- XMLWriter::openUri — Create new xmlwriter using source uri for output
- XMLWriter::outputMemory — Returns current buffer
- XMLWriter::setIndent — Toggle indentation on/off
- XMLWriter::setIndentString — Set string used for indenting
- XMLWriter::startAttribute — Create start attribute
- XMLWriter::startAttributeNs — Create start namespaced attribute
- XMLWriter::startCdata — Create start CDATA tag
- XMLWriter::startComment — Create start comment
- XMLWriter::startDocument — Create document tag
- XMLWriter::startDtd — Create start DTD tag
- XMLWriter::startDtdAttlist — Create start DTD AttList
- XMLWriter::startDtdElement — Create start DTD element
- XMLWriter::startDtdEntity — Create start DTD Entity
- XMLWriter::startElement — Create start element tag
- XMLWriter::startElementNs — Create start namespaced element tag
- XMLWriter::startPi — Create start PI tag
- XMLWriter::text — Write text
- XMLWriter::toMemory — Create new XMLWriter using memory for string output
- XMLWriter::toStream — Create new XMLWriter using a stream for output
- XMLWriter::toUri — Create new XMLWriter using a URI for output
- XMLWriter::writeAttribute — Write full attribute
- XMLWriter::writeAttributeNs — Write full namespaced attribute
- XMLWriter::writeCdata — Write full CDATA tag
- XMLWriter::writeComment — Write full comment tag
- XMLWriter::writeDtd — Write full DTD tag
- XMLWriter::writeDtdAttlist — Write full DTD AttList tag
- XMLWriter::writeDtdElement — Write full DTD element tag
- XMLWriter::writeDtdEntity — Write full DTD Entity tag
- XMLWriter::writeElement — Write full element tag
- XMLWriter::writeElementNs — Write full namespaced element tag
- XMLWriter::writePi — Writes a PI
- XMLWriter::writeRaw — Write a raw XML text
+add a note
User Contributed Notes 2 notes
Alexey Zakhlestin ¶
17 years ago
lingtalfi ¶
10 years ago
The single quote predefined entity is not escaped.
The other predefined entities are but not the single quote, so you will have to do it yourself.
That's what you would expect:
Ampersand & &
Single Quote ' '
Double Quote " "
Greater Than > >
Less Than < <
That's what you get with \XmlWriter:
Ampersand & &
Single Quote ' '
Double Quote " "
Greater Than > >
Less Than < <
↑ and ↓ to navigate •
Enter to select •
Esc to close • / to open
Press Enter without
selection to search using Google