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
Depending on the value of standalone, one of the following cases occurs:
If
XmlStandalone_Omit, the writer does not write a standalone attribute in the XML declaration.If
XmlStandalone_No, the writer writesstandalone="no".If
XmlStandalone_Yes, the writer writesstandalone="yes".
Return Value
Returns S_OK if no error is generated.
Remarks
The following example shows the use of WriteStartDocument:
if (FAILED(hr = pWriter->WriteStartDocument(XmlStandalone_Omit)))
{
wprintf(L"Error, Method: WriteStartDocument, error is %08.8lx", hr);
return -1;
}
A call to WriteStartDocument is the same as a call to WriteProcessingInstruction (IXmlWriterLite) passing a value of "xml" as the name argument. Therefore, a program cannot call WriteStartDocument and also call WriteProcessingInstruction using "xml" as the name argument for the same document. It is valid to call both WriteStartDocument and WriteProcessingInstruction for processing instructions that have a name other than the name "xml".
For a more detailed example of the WriteStartDocument method, see Write an XML Document using XmlLite.
Requirements
Header: XmlLite.h
Library: XmlLite.lib