---
title: "ID resolution"
description: "ID resolution when signing XML elements with PKI SDK, when the ID attribute has another name, set globally or locally."
canonical: "https://docs.lacunasoftware.com/en-us/articles/pki-sdk/signatures/xml/id-resolution"
locale: "en"
product: "PKI SDK"
last_updated: "2026-10-12"
---

# ID resolution

To sign an element of an XML document, the element must have an ID attribute that is unique in the document. If the XML uses a
different name for the ID attribute, you need to define an ID resolution.

The ID resolution can be defined globally, if the ID attribute change applies to the whole XML, or locally, if it applies to a
single element.

In the examples below, we sign the following XML, whose ID attribute is renamed to `licenseId`.

```xml
<license xmlns="http://www.lacunasoftware.com/">
    <licenseInfo licenseId=":9e2e5bbc-b4a0-41dc-a342-98f1554f32a3">
        <domain>www.contoso.com</domain>
        <domain>www.contoso.com</domain>
        <expiration>2016-03-23</expiration>
    </licenseInfo>
</license>
```

## Defining a global ID resolution table

If the change applies globally, the signing code is:

```cs
// Create ID resolution table for whole XML
var idResolutionTable = new XmlIdResolutionTable();
idResolutionTable.AddGlobalIdAttribute("licenseId");

var signer = new XmlElementSigner();
signer.SetXml(xml);
signer.SetSigningCertificate(cert);
signer.SetPolicy(policy);
signer.SetToSignElementId(":9e2e5bbc-b4a0-41dc-a342-98f1554f32a3");
signer.SetIdResolutionTable(idResolutionTable);                      // set ID resolution table
signer.ComputeSignature();
```

> **Note**
>
> If the attribute has a specific namespace, you can pass it to the same method,
> @Lacuna.Pki.Xml.XmlIdResolutionTable.AddGlobalIdAttribute(System.String,System.String)

## Defining a local ID resolution table

In this example, the ID change applies only to the `<licenseInfo>` element.

```cs
// Create ID resolution table for element name and namespace
var idResolutionTable = new XmlIdResolutionTable();
idResolutionTable.SetElementIdAttribute("licenseInfo", "http://www.lacunasoftware.com/", "licenseId");

var signer = new XmlElementSigner();
signer.SetXml(xml);
signer.SetSigningCertificate(cert);
signer.SetPolicy(policy);
signer.SetToSignElementId(":9e2e5bbc-b4a0-41dc-a342-98f1554f32a3");
signer.SetIdResolutionTable(idResolutionTable);                      // set ID resolution table
signer.ComputeSignature();
```

> **Note**
>
> If the attribute has a specific namespace, you can pass it to the same method,
> @Lacuna.Pki.Xml.XmlIdResolutionTable.SetElementIdAttribute(System.String,System.String,System.String,System.String)

## See also

* @Lacuna.Pki.Xml.XmlIdResolutionTable
* @Lacuna.Pki.Xml.XmlElementSigner
