Skip to main content

Module writer

Module writer 

Source
Expand description

XML Writer API (§30, §85 Phase 7).

Streaming XML writer with indentation, encoding, escaping, document lifecycle.

Provides the xmlTextWriter* family of functions that allow constructing XML documents in a streaming fashion — start/end element, write attributes, text content, CDATA, comments, processing instructions, and DTD declarations.

§UPSTREAM-PARITY

This module mirrors libxml2’s xmlTextWriter API defined in xmlwriter.h. The writer maintains a state machine that tracks whether we are inside an element start tag (attributes can be written), inside an attribute value, inside a CDATA section, etc.

Structs§

XmlTextWriter
A streaming XML writer.

Functions§

xmlFreeTextWriter
Free an XML text writer.
xmlNewTextWriter
Create a new XML text writer from an output buffer.
xmlNewTextWriterDoc
Create a new XML text writer for a document (tree mode).
xmlNewTextWriterFilename
Create a new XML text writer for a file.
xmlNewTextWriterMemory
Create a new XML text writer for a memory buffer.
xmlNewTextWriterTree
Create a new XML text writer for a subtree.
xmlTextWriterClose
Close the writer’s output buffer. The writer itself is NOT freed (upstream contract: xmlFreeTextWriter does that). Returns XML_ERR_OK (0) on success, XML_ERR_ARGUMENT (9) for a NULL writer or NULL output buffer.
xmlTextWriterEndAttribute
End an attribute (closes the attribute value quote).
xmlTextWriterEndCDATA
End a CDATA section.
xmlTextWriterEndComment
End a comment.
xmlTextWriterEndDTD
End a DTD declaration.
xmlTextWriterEndDTDAttlist
End a DTD attribute-list declaration.
xmlTextWriterEndDTDAttribute
End a DTD attribute declaration.
xmlTextWriterEndDTDElement
End a DTD element declaration.
xmlTextWriterEndDTDEntity
End a DTD entity declaration.
xmlTextWriterEndDocument
End an XML document.
xmlTextWriterEndElement
End an XML element.
xmlTextWriterEndPI
End a processing instruction.
xmlTextWriterFlush
Flush the writer’s output buffer.
xmlTextWriterFullEndElement
Write a full end element (always writes </name>, never self-closing).
xmlTextWriterSetIndent
Set indentation on/off.
xmlTextWriterSetIndentString
Set the indentation string.
xmlTextWriterSetQuoteChar
Set the quote character used for attribute and entity values.
xmlTextWriterStartAttribute
Write a formatted attribute.
xmlTextWriterStartAttributeNS
Start a namespaced attribute (to be written incrementally).
xmlTextWriterStartCDATA
Start a CDATA section.
xmlTextWriterStartComment
Start a comment.
xmlTextWriterStartDTD
Start a DTD declaration.
xmlTextWriterStartDTDAttlist
Start a DTD attribute-list declaration (<!ATTLIST name).
xmlTextWriterStartDTDAttribute
Start a DTD attribute declaration.
xmlTextWriterStartDTDElement
Start a DTD element declaration.
xmlTextWriterStartDTDEntity
Start a DTD entity declaration.
xmlTextWriterStartDocument
Start an XML document.
xmlTextWriterStartElement
Start an XML element.
xmlTextWriterStartElementNS
Start a namespaced XML element.
xmlTextWriterStartPI
Start a processing instruction.
xmlTextWriterWriteAttribute
Write an attribute.
xmlTextWriterWriteAttributeNS
Write a namespaced attribute.
xmlTextWriterWriteBase64
Write a formatted string.
xmlTextWriterWriteBinHex
Write BinHex-encoded data.
xmlTextWriterWriteCDATA
Write a CDATA section.
xmlTextWriterWriteComment
Write a comment.
xmlTextWriterWriteDTD
Write a DTD declaration.
xmlTextWriterWriteDTDAttlist
Write a DTD attribute-list declaration (StartDTDAttlist + WriteString + EndDTDAttlist).
xmlTextWriterWriteDTDAttribute
Write a DTD attribute declaration.
xmlTextWriterWriteDTDElement
Write a DTD element declaration.
xmlTextWriterWriteDTDEntity
Write a DTD entity declaration.
xmlTextWriterWriteDTDExternalEntity
Write a DTD external entity (StartDTDEntity + ExternalEntityContents + EndDTDEntity).
xmlTextWriterWriteDTDExternalEntityContents
Write the external-entity contents after StartDTDEntity (PUBLIC/SYSTEM identifiers and NDATA).
xmlTextWriterWriteDTDInternalEntity
Write a DTD internal entity (StartDTDEntity + WriteString + EndDTDEntity).
xmlTextWriterWriteDTDNotation
Write a DTD notation declaration.
xmlTextWriterWriteElement
Write an element with inline content.
xmlTextWriterWriteElementNS
Write a namespaced element with inline content.
xmlTextWriterWritePI
Write a processing instruction.
xmlTextWriterWriteRaw
Write raw content (no XML escaping).
xmlTextWriterWriteRawLen
Write raw content with explicit length (no XML escaping).
xmlTextWriterWriteString
Write text content.
xmlTextWriterWriteVFormatAttribute
xmlTextWriterWriteVFormatAttributeNS
xmlTextWriterWriteVFormatCDATA
xmlTextWriterWriteVFormatComment
xmlTextWriterWriteVFormatDTD
xmlTextWriterWriteVFormatDTDAttlist
xmlTextWriterWriteVFormatDTDElement
xmlTextWriterWriteVFormatDTDInternalEntity
xmlTextWriterWriteVFormatElement
xmlTextWriterWriteVFormatElementNS
xmlTextWriterWriteVFormatPI
xmlTextWriterWriteVFormatRaw
xmlTextWriterWriteVFormatString