Scenario
1. Page text is saved in a sql server from the editor.
2. Above page is then loaded into the editor, what is in the editor should be the same as what is on the SQL server now, however, it is not.
FCK Editor likes to re-arrange tags, for instance
would become
etc.
My issue is that I only want to commit a save to the database if there have been changes. I know I can use .IsDirty(), and I am for the auto-save functionality, but I don't want to rely on that completely. When the user presses the save button I want to check on the server if what is on the server now is the same as what is coming from the editor. The first save always reports at different. Each save there-after as the same (assuming I hadn't changed anything).
Reload the page and thus the data from the server will cause a repeat, first click = save, all other = no save.
So, even though what is on the server came from the editor just a few seconds ago, when that is loaded back into the editor it is "messed" with by the editor so as to make the checking code useless (or pretty close to useless anyway).
I've tried things like
FCKConfig.FormatSource = false;
FCKConfig.FormatOutput = false;
with no luck.
Does anyone know of a work around, or is this a bug I should post a ticket for?
1. Page text is saved in a sql server from the editor.
2. Above page is then loaded into the editor, what is in the editor should be the same as what is on the SQL server now, however, it is not.
FCK Editor likes to re-arrange tags, for instance
<a href="bob.html" target="_blank">
would become
<a target="_blank" href="bob.html">
etc.
My issue is that I only want to commit a save to the database if there have been changes. I know I can use .IsDirty(), and I am for the auto-save functionality, but I don't want to rely on that completely. When the user presses the save button I want to check on the server if what is on the server now is the same as what is coming from the editor. The first save always reports at different. Each save there-after as the same (assuming I hadn't changed anything).
Reload the page and thus the data from the server will cause a repeat, first click = save, all other = no save.
So, even though what is on the server came from the editor just a few seconds ago, when that is loaded back into the editor it is "messed" with by the editor so as to make the checking code useless (or pretty close to useless anyway).
I've tried things like
FCKConfig.FormatSource = false;
FCKConfig.FormatOutput = false;
with no luck.
Does anyone know of a work around, or is this a bug I should post a ticket for?
Re: Editor re-aranges tag ellements
If you want to diff two XML documents, comparing XML text is a simplistic approach and it will never work reliably (besides attribute order, you would have to deal with whitespace normalization, character references, etc). If you want to do it right, you need either normalize each document and then compare text or run XML through a parser and compare nodes, as they are found (SAX) or node by node (DOM).