in Education by
I am using Adobe Flex/Air here, but as far as I know this applies to all of JavaScript. I have come across this problem a few times, and there must be an easy solution out there! Suppose I have the following XML (using e4x): var xml:XML = foo I can change the contents of the example node using the following code: xml.example = "bar"; However, if I have this: var xml:XML = foo How do i change the contents of the root node? xml = "bar"; Obviously doesn't work as I'm attempting to assign a string to an XML object. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
It seems you confuse variables for the values they contain. The assignment node = textInput.text; changes the value the variable node points to, it doesn't change anything with the object that node currently points to. To do what you want to do you can use the setChildren method of the XML class: node.setChildren(textInput.text)

Related questions

0 votes
    I am using Adobe Flex/Air here, but as far as I know this applies to all of JavaScript. I have ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 30, 2022 in Education by JackTerrance
0 votes
    Which node type represents the root-node of the DOM tree? (a) Document (b) DocumentFragment (c) ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 23, 2021 in Education by JackTerrance
0 votes
    In crabbing protocol, the lock obtained on the root node is in _________ mode. (a) Shared (b) ... in Index Structures in portion Concurrency Control of Database Management...
asked Oct 10, 2021 in Education by JackTerrance
0 votes
    B-tree of order n is a order-n multiway tree in which each non-root node contains __________ a) at most (n – 1)/2 keys ... ) at least 2n keys d) at least (n – 1)/2 keys...
asked Dec 23, 2020 in Technology by JackTerrance
0 votes
    I have 2 models: class Annotation include Mongoid::Document belongs_to :event field :desc, type: String end ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 23, 2022 in Education by JackTerrance
0 votes
    I've just joined my friend's Team Services account (free for the first 5 users account). If I visit the home ... how to resolve this? Select the correct answer from above options...
asked Jan 31, 2022 in Education by JackTerrance
0 votes
    How to assign the label 1 to rows which satisfy the below following conditions: If the Word column contains Amber ... it does not work Select the correct answer from above options...
asked Jan 8, 2022 in Education by JackTerrance
0 votes
    All lock information is managed by a __________ which is responsible for assigning and policing the locks ... Database Interview Questions and Answers for Freshers and Experience...
asked Oct 11, 2021 in Education by JackTerrance
0 votes
    In multidimensional array mySubject, which of the following will allow assigning the value 100 in position 5 of the third mySubject array? 1 ... ][4] = 100 5. mySubject[3][5] = 100...
asked Feb 24, 2021 in Technology by JackTerrance
0 votes
    What are the advantages of assigning the central pier and the abutment as fixed piers?...
asked Jan 1, 2021 in Technology by JackTerrance
+1 vote
    In multidimensional array mySubject, which of the following will allow assigning the value 100 in position 5 of the third mySubject array? a ... 2][4] = 100 e)mySubject[3][5] = 100...
asked Oct 8, 2020 in Technology by JackTerrance
0 votes
    In LISP, the square root of X is referenced as _____________ (a) sqrt(x) (b) (sqrt x) (c) x/2 (d) x/3 Please answer the above question....
asked Sep 21, 2022 in Education by JackTerrance
0 votes
    What is root word of state Please answer the above question....
asked Aug 3, 2022 in Education by JackTerrance
0 votes
    Is it possible to create a complete SD image in linux without having root privileges (that is, no loopback ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 2, 2022 in Education by JackTerrance
0 votes
    I'm developing an e-learning application. In one exercise, I'd like to have our students read a ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 23, 2022 in Education by JackTerrance
...