I noticed that sometimes, <text> nodes in a document are assigned different ids on load without obvious reason - there's no id clash in the source document. I found out that this is caused by text repr nodes (i.e. text strings, not <text> elements) being assigned their own id= too, even though this id is not seen or editable anywhere and is not saved with the document. And the problem is that these text node ids also start with "text" followed by a number, and therefore can clash with <text> ids forcing them to re-id. I fixed this by making these text nodes use ids starting with "string" instead of "text". The change is in line 76 of repr.cpp. I hope this does not break anything; comments are welcome.
On Tue, 2004-10-26 at 05:50, bulia byak wrote:
I noticed that sometimes, <text> nodes in a document are assigned different ids on load without obvious reason - there's no id clash in the source document. I found out that this is caused by text repr nodes (i.e. text strings, not <text> elements) being assigned their own id= too, even though this id is not seen or editable anywhere and is not saved with the document. And the problem is that these text node ids also start with "text" followed by a number, and therefore can clash with <text> ids forcing them to re-id. I fixed this by making these text nodes use ids starting with "string" instead of "text". The change is in line 76 of repr.cpp. I hope this does not break anything; comments are welcome.
Ah, yes... FWIW, your change should not cause any problems.
Eventually we need to stop creating SPObjects for text (and comment) XML nodes, at which point it would no longer be an issue.
[ we will certainly have to do it before we implement the object tree dialog, as otherwise things would get very weird to implement ]
The reasons that XML text nodes have IDs right now are historical:
1) undo originally used ID strings to address all XML nodes rather than direct pointers
2) the old text code put a lot of intelligence in SPString, an SPObject bound to text nodes, so we were stuck with SPObjects for text nodes
The first one went away when I wrote the repr transaction layer for Sodipodi. I've not looked into fred's text rewrite to see whether it has made the second easy to get rid of.
-mental
participants (2)
-
bulia byak
-
MenTaLguY