There are lots of crazy ways of manipulating XML in ActionScript.Here are a few simple tips and tricks on manipulating XML in Actionscript.
<branchName>023</branchName>
<contfirstname></contfirstname>
<contlastname></contlastname>
<contmailsort></contmailsort>
<contphone></contphone>
</searchCriteria>
2. Preview an XML Variable : An XML variable can be previewed in an Alert Box by converting the XML to a string object
Alert.show(tempSearchXML.toString());
3. Getting the value of a Node in the XML:
Alert.show(tempSearchXML.branchName.toString());
4. Setting the Value of Node in the XML : The following code sets the value of a node 'contfirstname '.
tempSearchXML.contfirstname ="Armaghan";
5. Setting / Changing / Updating the Node Attribute in the XML: The following code snippet changes the name of a Node from 'contlastname' to 'lastname'.
tempSearchXML.contlastname.setName("lastname") ;
5. Delete a Node in the XML: The following code snippet deletes a Node called 'contphone' in the XML.
delete tempSearchXML.contphone;
6. Adding a Node in the XML: The following code snippet adds a Node called 'text' in the XML and sets its value at the same time.
tempSearchXML.text ="Taylor" ;
Happy Coding :)
- Declaring an XML Variable: An XML variable can be created in ActionScript as follows :
<branchName>023</branchName>
<contfirstname></contfirstname>
<contlastname></contlastname>
<contmailsort></contmailsort>
<contphone></contphone>
</searchCriteria>
2. Preview an XML Variable : An XML variable can be previewed in an Alert Box by converting the XML to a string object
Alert.show(tempSearchXML.toString());
3. Getting the value of a Node in the XML:
Alert.show(tempSearchXML.branchName.toString());
4. Setting the Value of Node in the XML : The following code sets the value of a node 'contfirstname '.
tempSearchXML.contfirstname ="Armaghan";
5. Setting / Changing / Updating the Node Attribute in the XML: The following code snippet changes the name of a Node from 'contlastname' to 'lastname'.
tempSearchXML.contlastname.setName("lastname") ;
5. Delete a Node in the XML: The following code snippet deletes a Node called 'contphone' in the XML.
delete tempSearchXML.contphone;
6. Adding a Node in the XML: The following code snippet adds a Node called 'text' in the XML and sets its value at the same time.
tempSearchXML.text ="Taylor" ;
Happy Coding :)