I am using your Delphi library for XML in order to sign electronically documents before hand in them by uploading it to a website. At the beginning it worked right but then it started to refuse the signature. I have some other software from a different party that generates the same document and it is correctly validated.

I run some test in other different validators and most of them also fail to validate the document, and one of them run into:

fooElem.setIdAttribute("bar", true); // without this, 'found' would be null

Element found = doc.getElementById("xyz");

This has to be done for each element node that has one of these type of attributes on them. There is no simple built-in method to make all occurrences of attributes with a given name (e.g. "id") be of attribute type ID.

This third approach is only useful in situations where the code calling the getElementById() is separate from that creating the DOM. If it was the same code, it already has found the element to set the ID attribute so it is unlikely to need to call getElementById().

Most of my ressearch in Google for that Exception bring me to that exact same issue, and all the validating tools I am using are made in Java so the problem have to be with the IDs.

So my question is, is there any way to indicate that the attribute "ID" is the actual Id attribute for SignedProperties when signing with your library?
I am using also a references for KeyInfo so it is possible for KeyInfo too?

So my question is, is there any way to indicate that the attribute "ID" is the actual Id attribute for SignedProperties when signing with your library?
I am using also a references for KeyInfo so it is possible for KeyInfo too?

It is possible that this third party java application is not aware of this XML schema.
Unfortunately, there is no property that allows to change Id attribute name. But, you can use TElXMLSigner.OnFormatElement event for this. For example, place a following code to the event handler:

I forgot to tell you some details but I assume you have deduced most of it.
The signature we are using is XAdES EPES 1.3.2 and generating it with the AdvanceSigner example for delphi with some modifications.

I have already tried what you suggested. The error stops appearing for SignedProperties, but same error shows for KeyInfo. In the other document I have, the one which validates, it is used Id not ID like in the wrong one.

It is possible that it may be caused because of the place where namespaces are declared?

It is possible that it may be caused because of the place where namespaces are declared?

Usually, the place where namespace declared (if it declared in the node that using it or in the parent node) or the prefix name should not be important. Of course, you shouldn't change them after signing. But, sometimes, some applications have own rules.

We use cookies to help provide you with the best possible online experience. By using this site, you agree that we may store and access cookies on your device. You can find out more about and set your own preferences here.