Discuss this help topic in SecureBlackbox Forum

XML: Add reference to several nodes

To add a reference to several document elements you need to put a string value, which uniquely identifies the referenced parts, to TElXMLReference.URI property, and then put a reference to the set of elements to TElXMLReference.URINodes property, which will be used for reference computation.

C#:


NodeSet = XMLDocument.SelectNodes(@"//*[@secure='true']");
Ref = new TElXMLReference();
Ref.URI = @"#xpointer(//*[@secure='true'])";
Ref.URINodes = NodeSet;
Signer.References.Add(Ref); // add the reference to TElXMLSigner object
...
Delphi:

NodeSet := XMLDocument.SelectNodes('//*[@secure=''true'']');
Ref := TElXMLReference.Create();
Ref.URI := '#xpointer(//*[@secure=''true''])';
Ref.URINodes := NodeSet;
Signer.References.Add(Ref); // add the reference to TElXMLSigner object
...
// when signing is finished we need to clear TElXMLNodeSet object
NodeSet.Free();

How To articles about XML signing (XMLDSig and XAdES)

Discuss this help topic in SecureBlackbox Forum