Thanks for the response.
I'm not so sure. A lot of people have argued that the values of the DOM as a whole should be immutable, and I tend to agree. The name of a node is generally bound to its context, whether that be DTD, Schema, or whatever. Changing the name of a node presents potential problems beyond the actual naming. One of them being that you invalidate a document by doing it.
The immutability greatly reduces your options while building the document. The doc shouldn't be considered valid or invalid until it's finished. It's not so much that I want to change a node's name from one thing to another; I want to create a node with no name at all and then set the name further down in the logic.
Another is that your DOM implementation may be creating specially subclassed DOM nodes based on the name of the node. These subclassed nodes may be used for data binding, or special application purposes. If you change the name of the node, what happens to the class of the node?
This is very similar to (but sort of opposite to) my situation. I'm creating nodes to store Java (or C++) objects as XML. If you're doing this, and you're converting subclassed objects into XML, it stands to reason that you'd have one routine to write the base-class data members, and another routine to add extra members of the subclass, and so on down the class hierarchy.
Because of unrenamable elements, you can't have a series of conversion routines that return an Element. Like
public Element XMLConvert(BaseClass object)
{
Element resultElem = m_doc.createElement("BASE_CLASS");
// Add some stuff. return resultElem;
} public Element XMLConvert(ChildClass object)
{
// Start with the base-class (BaseClass) members.
Element resultElem = XMLConvert((BaseClass)object);// Now we'd like to name the element after this class, but Noooooo.
// How about: resultElem.setTagName("CHILD_CLASS");
// Now add the data members of the ChildClass.
// Make an element here for some data member here, and then
resultElem.appendChild(the element) return resultElem;
} public Element XMLConvert(GrandChildClass object)
{
// Start with the base-class (ChildClass) members.
Element resultElem = XMLConvert((ChildClass)object);// Now we'd like to name the element after this class, but again Noooooo.
// How about: resultElem.setTagName("GRAND_CHILD_CLASS");
// Now add the data members of the GrandChildClass.
// Make an element for some data member here, and then...
resultElem.appendChild(the element); return resultElem;
}--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
