How to get page-source of an element?

Hi everyone,

Is it possible to get the page-source of a single element?
What i want is just the pagesource of an element of a native app. I have googled allot and found that its possible for webpages but did not get any solution for mobile’s native app.
like below examples.



WebElement element = driver.findElement("foo"));
String contents = (String)((JavascriptExecutor)driver).executeScript("return arguments[0].innerHTML;", element);