I've been using NativeXml for years to create xml from my program's data. This has worked very well but now I've hit a snag.
I now need to insert a hash into the xml which has been created from a canonical form of the xml. I've had a look and Native Xml has a function "Canonicalize" but either I'm not using it properly (a good chance) or (as it is labelled experimental) it doesn't do what is required.
I've been using it like this (as suggested in the only example I could find)
MyXmlFile.Canonicalize;
I've been sending xml to a test service with no problems so I assumed everything was OK. The recipient was accepting the xml submissions and the hash code. Canonicalize strips the opening xml tag <?xml version="1.0"?>
but as the xml is fairly well formed anyway and I'm not setting its format to xfReadable
I couldn't find much difference.
Now I've come across a problem. One piece of data has shown that everything isn't working quite as it should.
If I have a name which contains an apostrophe in my data, such as O'Reilly for example, then in the xml it gets written (correctly) like this
<Surname>O'Reilly</Surname>
As far as I can tell when it has been canonicalized this should show as
<Surname>O'Reilly</Surname>
This isn't happening so consequently the recipient is rejecting my xml submissions as the hash does not match.
I've spent the last two days trawling through the NativeXml code and documents and also online and can't find an answer. Sadly the NativeXml forum seems to be devoid of life too.
Is there anything I should be doing with NativeXml? If not NativeXml then will anything else do the job? Is there anything I can pass the xml to that will canonicalize it properly?
The current version of NativeXML (4.07) fetches named character entities from the DTD and expands them. The four predefined named character entities of course aren't in any DTD, so they're not processed. It looks like numeric character entities also aren't canonicalized, and there are several other transformations yet to be implemented. NativeXML simply isn't the right tool for the job in its current state.