IOpcSignatureCustomObject::GetXml method (msopc.h)

Gets the XML markup of an application-specific Object element.


  [out] UINT8  **xmlMarkup,
  [out] UINT32 *count


[out] xmlMarkup

A pointer to a buffer that contains the XML markup of an Object element and includes the opening and closing Object tags.

In the buffer, XML markup is preceded by a byte order mark that corresponds to the encoding of the markup.

Supported encodings and byte order mark values.

Encoding Description Byte order mark
UTF16LE UTF-16, little endian FF FE
UTF16BE UTF-16, big endian FE FF

For an example of a buffer with a byte order mark, see the Remarks section.

[out] count

A pointer to the size of the xmlMarkup buffer.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return code Description
The method succeeded.
At least one of the xmlMarkup, and count parameters is NULL.


This method allocates memory used by the buffer returned in xmlMarkup. If the method succeeds, call the CoTaskMemFree function to free the memory.

Serialized application-specific Object elements in signature markup can be added, removed, or modified by replacing the signature markup.

To replace signature markup, call the IOpcDigitalSignatureManager::ReplaceSignatureXml method. The caller must ensure that addition, deletion, or modification of application-specific Object elements does not break the signature.

To sign an application-specific Object element or a child of that element, create a reference to the XML element to be signed. Create the reference by calling the IOpcSignatureReferenceSet::Create method with the referenceUri parameter value set to "#" followed by the Id attribute value of the referenced element. For example, if the Id attribute of the referenced element is "Application", set referenceUri to "#Application".

The following table shows a byte order mark at the beginning of an xmlMarkup buffer that contains "<Object Id="id1"></Object>":

Buffer Byte Index 0 1 2 3 4 5 6 7 ...
UTF8 Value EF BB BF '<' 'O' 'b' 'j' 'e' ...
UTF16LE Value FF FE '<' 00 'O' 00 'b' 00 ...

Thread Safety

Packaging objects are not thread-safe.

For more information, see the Getting Started with the Packaging API.


Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header msopc.h

See also

Core Packaging Interfaces

Getting Started with the Packaging API





Packaging API Programming Guide

Packaging API Reference

Packaging API Samples

Packaging Digital Signature Interfaces

Packaging Interfaces