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 &amp; Joe.
In general, use
xmlWriterWrite(), unless you happen to have
already escaped output.
Below are the functions for writing various kinds of XML structures.