Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Writes out the XML declaration with the version "1.0". The encoding attribute is determined by the implementation of IXmlWriterOutput. By default, the encoding is UTF-8.
Syntax
HRESULT WriteStartDocument (XmlStandalone standalone);
Arguments
standalone
If XmlStandalone_Omit
does not write a standalone attribute in the XML declaration, one of the following occurs:
If
XmlStandalone_No
, the writer writes standalone="no".If
XmlStandalone_Yes
, the writer writes standalone="yes".
Return Value
Returns S_OK if no error is generated.
Remarks
The following shows the use of WriteStartDocument
:
if (FAILED(hr = pWriter->WriteStartDocument(XmlStandalone_Omit)))
{
wprintf(L"Error, Method: WriteStartDocument, error is %08.8lx", hr);
return -1;
}
Caling WriteStartDocument is the same as calling WriteProcessingInstruction passing a name of "xml" as an argument. Therefore, a program cannot successfully call both WriteStartDocument
and WriteProcessingInstruction passing the name "xml" for the same document. It is valid to call WriteStartDocument
and WriteProcessingInstruction for processing instructions that have a name other than the name "xml".
For a more detailed example of theWriteStartDocument
method, see Write an XML Document using XmlLite.
Requirements
Header: XmlLite.h
Library: XmlLite.lib