how to add an attribute to XML node?

if (child is WinCRLFTextArea) { var node:XML;

                        node = <{child.name}>{WinCRLFTextArea(child).text}</{child.name}>;
                        textXML.appendChild(node);
                    }

I want to add an attribute like "beginIndex" and "endIndex" to node element. dynamically i need to assign values to this attributes. ex: beginIndex = WinCRLFTextArea(child).text.length is it possible ? please anyone help me out for this.

Thanks in advance.

Answers


You can add/edit/read attributes with the ”@” operator.

var myXML:XML = <xml> <some> <node/> </some> </xml>;

myXML.some.node.@beginIndex = "1";

trace( myXML.some.node.@beginIndex ); // output: 1;

Need Your Help

How Microsoft makes money out of silverlight? How Adobe makes money out of Flash? c#

c# flash silverlight adobe

I am just wondering how companies make money by offering free RIA application development platforms.They invested lot of money &amp; human resources to create &amp; improve those platforms. Of cour...

JQuery/CSS: Append div using mouse coords and position: absolute

javascript jquery css position

OK complicated one - I have created some code to append a div within a wrapper div: