Writing Output

The contents of nodes (elements, attributes, comments, etc) can be output through two functions, depending on whether the output is already escaped.

xmlWriterWrite() takes a string and encodes it for XML output. This properly escapes things that aren't well-formed. Things such as Bob & Joe will be outputted as the XML-safe Bob & Joe.

xmlWriterWriteRaw(), on the other hand, writes exactly what you give it. This is handy if you already have a string that contains Bob & Joe, and want to write that out. xmlWriterWrite() would output that as Bob & Joe.

In general, use xmlWriterWrite(), unless you happen to have already escaped output.


SEE ALSO
xmlWriterWrite, xmlWriterWriteRaw

Below are the functions for writing various kinds of XML structures.

Elements

xmlWriterStartElement xmlWriterWrite xmlWriterEndElement

xmlWriterWriteElement

Attributes

xmlWriterStartAttribute xmlWriterWrite xmlWriterEndAttribute

xmlWriterWriteAttribute

Comments

xmlWriterStartComment xmlWriterWrite xmlWriterEndComment

xmlWriterWriteComment

Processing Instruction

xmlWriterStartPI xmlWriterWrite xmlWriterEndPI

xmlWriterWritePI

CDATA

xmlWriterStartCDATA xmlWriterWrite xmlWriterEndCDATA

xmlWriterWriteCDATA


Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.