[fpc-pascal] renaming XML element
Marc Santhoff
M.Santhoff at web.de
Tue May 4 19:30:33 CEST 2010
Hi,
since I'm only rarely using XML and the DOM unit I have to ask:
I need to rename an element inside an XML tree. I've learned that
elements are immutable in the DOM implementation, so renaming has to be
done by
- makeing a new element with the new name
- copying over the complete subtree (childs, attributes, #text)
- attaching the new element directly after the to be renamed one
- removing the old element node
Is this correct?
And how would I do that using the DOM implementation, I'm really not
sure what methods to use ...
Example
-------
Now:
<doc>
<oldnode>whatever or nothing</oldnode>
<child1></child1>
...
<nextsibling></nextsibling>
...
</doc>
Afterwards:
<doc>
<newnode>whatever or nothing</newnode>
<child1></child1>
...
<nextsibling></nextsibling>
...
</doc>
All of the nodes except root may have attributes, text content and child
nodes.
Marc
--
Marc Santhoff <M.Santhoff at web.de>
More information about the fpc-pascal
mailing list