IOpcDigitalSignature::GetNamespaces method (msopc.h)

Gets the prefix and namespace mapping of the Signature element of the signature markup.

Syntax

HRESULT GetNamespaces(
  [out] LPWSTR **prefixes,
  [out] LPWSTR **namespaces,
  [out] UINT32 *count
);

Parameters

[out] prefixes

A pointer to a buffer of XML prefix strings. If the method succeeds, call the CoTaskMemFree function to free the memory of each string in the buffer and then to free the memory of the buffer itself.

[out] namespaces

A pointer to a buffer of XML namespace strings. If the method succeeds, call the CoTaskMemFree function to free the memory of each string in the buffer and then to free the memory of the buffer itself.

[out] count

The size of the prefixes and namespaces buffers.

Return value

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

Return code Description
S_OK
The method succeeded.
E_POINTER
The prefixes parameter is NULL.
E_POINTER
The namespaces parameter is NULL.
E_POINTER
The count parameter is NULL.

Remarks

The prefixes and namespaces buffers are mapped to each other by index.

This method allocates memory used by the buffers returned in prefixes and namespaces and the strings contained in each buffer.

Examples

The following code shows how to use CoTaskMemFree to free the memory of the buffers and the strings they contain.

// Prepare to call GetNamespaces
LPWSTR* prefixes = NULL;
LPWSTR* namespaces = NULL;
UINT32 count = 0;

// Call to GetNamespaces succeeds
if ( SUCCEEDED( signature->GetNamespaces(&prefixes, &namespaces, &count) ) )
{
    // Process strings in prefixes and namespaces as needed for the application

    // Free memory for each string
    for (UINT32 i = 0; i < count; i++)
    {
        CoTaskMemFree(prefixes[i]);
        CoTaskMemFree(namespaces[i]);
    }
    // Free memory for the buffers
    CoTaskMemFree(prefixes);
    CoTaskMemFree(namespaces);
}

Requirements

Requirement Value
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

Digital Signatures Overview

Getting Started with the Packaging API

IOpcDigitalSignature

Overviews

Packaging API Programming Guide

Packaging API Reference

Packaging API Samples

Packaging Digital Signature Interfaces

Packaging Interfaces

Reference