re: "I'm using CS3 version 5.0.4 (the debug build because most of the time I'm working directly with the API - not through scripting)."
I don't quite understand this...?
Help me understand: are you trying to create an XML element in ExtendScript? Or are you trying to create an XML element in InDesign?
Hi Ole, thanks for the reply.
Well, there's always eval():
var someXML = new XML(""); someXML.@xxx = "something"; $.writeln(someXML.toXMLString()); var myString = "yyy"; eval("someXML.@" + myString + " = \"something\""); $.writeln(someXML.toXMLString());
It seems to me that there's probably a better way, but I thought that this workaround might help you out in the short term.
Where did you get "getAttribute"? I can't find that anywhere in the XML object reference. There's XML.attributes(string), which is supposed to return the attributes that match the string, but it seems to return the contents of all of the attributes in the element.
Thanks a lot. Using eval is a good workaround - much better than to/from string, and is working
Sorry getAttribute was a mistake - it should have been someXML.attribute("xxx") = "something" (which also didn't work for me but should have).