850264 wrote:In which case, as I say, you may get away with it; but that's all you're doing (and I'd say that your version is better than Ankur's, because it's tailored specifically to your requirement). However, if you find you need any more "similar" code to get other values, I'd definitely go the XPath route; in fact, I'd probably do it anyway.
The xml format isn't going to change. It is the way opennebula, (cloud computing software) stores the information about a virtual machine.
EJP wrote:i didn't mean that, it was just for information. And this is not about the no of lines of code its about result.i tried it and i got 1 as a result value of CPU tag.Nobody said you wouldn't. You can get it via XPATH in about 5 lines of code.