I think I'm on to something. Using eval(), I can add a dynamically named child, I think. It's working so far. Hope this is helpful for someone else.
XMLObject = new XML(<xml/>); eval("XMLObject.appendChild(<" + nameReference + ">/);");
Now, I'll make this a function so I don't have to keep writing it over and over again. I imagine I can reference the node in a similar way . . . I hope.
Maybe have a look at Mozilla's E4X tutorial: https://developer.mozilla.org/en/E4X_Tutorial/
There's no need for eval() here. (There usually isn't.) Use:
To add an attribute, you can just use:
XMLObject.@new_att = "the value";
1 person found this helpful
XMLObject["@new_att"] = "the value";
With a slight variation the attribute name can also be specified as string, see above.
To remove the attribute, delete it.
Thank you! This is exactly what I needed. I have been scouring the web looking for something like this.
I'm still quite the n00b, so thanks for the help.