Delphi - Can I create canonical XML with NativeXml?

I have been using NativeXml for many years to create xml from my program data. This worked very well, but now I am trapped.

Now I need to insert the hash into the xml that was created from the canonical xml form. I looked, and Native Xml has a โ€œCanonicalizeโ€ function, but either I do not use it properly (good chance), or (since it is marked as experimental), it does not do what is required.

I used it like this (as suggested in the only example I could find)

MyXmlFile.Canonicalize; 

I sent xml to the test service without problems, so I decided that everything was fine. The receiver accepted the XML representations and the hash code. The canonical strip opens the open xml tag <?xml version="1.0"?> , But since the xml is well formed and I do not set its xfReadable format, I could not find much difference.

Now I am facing a problem. One piece of data showed that everything does not work as it should.

If I have a name that contains an apostrophe in my data, for example, O'Reilly, then in xml it is written (correctly), like this

 <Surname>O&apos;Reilly</Surname> 

As far as I can tell, when it was canonized, this should be displayed as

 <Surname>O'Reilly</Surname> 

This does not happen, so the recipient rejects my XML views because the hash does not match.

I spent the last two days making my way through the NativeXml code and documents, as well as on the Internet and cannot find the answer. Unfortunately, the NativeXml forum seems to be lifeless.

Is there anything I should do with NativeXml? If not NativeXml, will anything else be done? Is there anything that I can pass xml so that it canonizes it correctly?

+4
source share
1 answer

The current version of NativeXML (4.07) extracts character names from DTDs and extends them. Of course, four predefined named character objects are not in the DTD, so they are not processed. It seems that numeric character entities are also not canonized, and there are still a few more transformations. NativeXML is simply not suitable for working in its current state.

+2
source

All Articles