Executing a string related to source code, not the command line

From: Arun (arun_hallan_at_hotmail.com)
Date: 12/30/04


Date: 30 Dec 2004 11:59:15 -0800

How can i execute a string, for example:

int x = 2;
int y = 4;
int z;
String command = " z = x*y "

For some background on why i want to do this:

I have an element tree.
To add a certain element, i need to use the following command:
element.getChild("bla").setContent(newElement);

Problem is that the number of .getChild() corresponds to the element
depth in the tree.
So if its depth was two, then the command would be:
element.getChild("bla's dad").getChild("bla").setContent(newElement);

I can't do a for loop and then with every iteration get the child from
the previous child, because when i add an element i won't be adding it
to the whole element tree, il just be adding it to the previous
element.

I could build the whole tree again but that seems wasteful.



Relevant Pages

  • [RFC: 2.6 patch] remove the broken SCSI_ACORNSCSI_3 driver
    ... * Abandoned using the Select and Transfer command since there were ... Once debugged, remove the #undef, otherwise to debug, ... -unsigned int dmac_address ... * Purpose: differentiate between commands that have a DATA IN phase ...
    (Linux-Kernel)
  • [RFC: 2.6 patch] remove drivers/net/eepro100.c
    ... This patch removes the obsolete drivers/net/eepro100.c driver. ... -static int rx_copybreak = 200; ... Each Tx command block ... -static void speedo_resume(struct net_device *dev); ...
    (Linux-Kernel)
  • RFC: [2.6 patch] small IPMI cleanup
    ... The patch below does the following changes to the IPMI code: ... * Send a command request from the given user. ... * the message response comes back, the receive handler for this user ... static int ipmi_init_msghandler; ...
    (Linux-Kernel)
  • [PATCH] Cleanups for the IPMI driver
    ... off the shutdown of the timer when removing the module. ... static int ipmi_init_msghandler; ... * Send a command request from the given user. ... * the message response comes back, the receive handler for this user ...
    (Linux-Kernel)
  • Re: [PATCH, RFC] hide EH backup data outside the scsi_cmnd
    ... This means drivers can easily get at it and misuse it. ... rtn = FAILED; ... int retry_cnt = 1, rtn; ... Immediately prior to retrying a command, ...
    (Linux-Kernel)