WsWriteStartElement function (webservices.h)
Writes a start element to the writer.
After calling this function WsWriteStartAttribute or WsWriteXmlnsAttribute can be called to write additional attributes to the element. The element is not committed to the writer until WsWriteEndElement or some other function that writes content is called.
Syntax
HRESULT WsWriteStartElement(
[in] WS_XML_WRITER *writer,
[in, optional] const WS_XML_STRING *prefix,
[in] const WS_XML_STRING *localName,
[in] const WS_XML_STRING *ns,
[in, optional] WS_ERROR *error
);
Parameters
[in] writer
A pointer to the WS_XML_WRITER object to which the start element is written. The pointer must reference a valid XML Writer object.
[in, optional] prefix
A WS_XML_STRING pointer to the prefix to use for the start element. If the value referenced by this parameter is NULL the Writer will choose a attribute.
[in] localName
A WS_XML_STRING pointer to the local name used by the start element. It must be at least one character long.
[in] ns
A WS_XML_STRING pointer to the namespace to be used for the start element.
If no prefix is specified the Writer may use a prefix in scope that is bound to the specified namespace or it may generate a prefix and include an XMLNS attribute. If a prefix is specified the Writer will use that prefix and may include an XMLNS attribute if needed to override an existing prefix in scope.
[in, optional] error
A pointer to a WS_ERROR object where additional information about the error should be stored if the function fails.
Return value
This function can return one of these values.
Return code | Description |
---|---|
|
One or more arguments are invalid. |
|
The operation is not allowed due to the current state of the object. |
|
The input data was not in the expected format or did not have the expected value. |
|
A quota was exceeded. |
Remarks
If the underlying encoding supports empty elements and the element has no content an empty element is written.
If a non-empty prefix is specified with an empty namespace WS_E_INVALID_FORMAT is returned.
If writing the start element causes WS_XML_WRITER_PROPERTY_MAX_DEPTH to be exceeded WS_E_QUOTA_EXCEEDED is returned. (See Windows Web Services Return Values.)
When using WS_XML_WRITER_MTOM_ENCODING it is an error to attempt to write an element with the localName "Include" from the namespace"http://www.w3.org/2004/08/xop/include".
WsWriteStartAttribute can also be used to add an attribute to an element when the writer is positioned on an element using WsMoveWriter or WsSetWriterPosition.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 7 [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2008 R2 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | webservices.h |
Library | WebServices.lib |
DLL | WebServices.dll |