WriteProcessingInstruction (Compact 2013)
3/26/2014
This method writes a processing instruction.
Syntax
HRESULT WriteProcessingInstruction (
const WCHAR* pwszName,
const WCHAR* pwszText
);
Parameters
- pwszName
The name of the processing instruction. This parameter cannot be empty or NULL.
- pwszText
The text content of the processing instruction. NULL is the same as an empty string.
Return Value
This method returns S_OK if no error is generated.
Remarks
The writer creates a processing instruction by writing the provided name and text with a space after the name.
If the pwszText parameter is NULL, this method returns S_OK and writes a processing instruction without any text content.
If the text block provided contains the characters "?>
" that signifies the end of a processing instruction, the writer inserts a space after the "?
" character. This change prevents the writer from producing an XML document that is not well-formed.
The following code shows the use of WriteProcessingInstruction:
if (FAILED(hr = pWriter->WriteProcessingInstruction(L"xml-stylesheet",
L"href=\"mystyle.css\" title=\"Compact\" type=\"text/css\"")))
{
wprintf(L"Error, Method: WriteProcessingInstruction, error is %08.8lx", hr);
return -1;
}