I'm currently working with an automation framework that is pulling a webpage down for analysis, which is then presented as a string for processing. The Rhino Javascript engine is available to assist in parsing the returned web page.
It seems that if the string (which is a complete webpage) can be loaded in a DOM representation, it would provide a very nice interface for parsing and analyzing content.
Using only Javascript, is this a possible and/or feasible concept?
Edit:
I'll decompose the question for clarify: Say I have an string in javascript that contains html like such:
var $mywebpage = '<!DOCTYPE HTML PUB ...//snipped//... </body></html>';
is it possible/realistic to load it somehow into a dom object?
I'm accepting JonDavidJohn's answer as it was useful in solving my problem, thought including this additional answer for others that may view this in the future.
It appears that while Javascript allows the loading of html strings into a DOM element, DOM is not part of core ECMAScript, and as such is not available to scripts running under Rhino.
As a side note worth mentioning, a good alternative that was implemented in Rhino 1.6 is E4X. While not a DOM implementation, it does provide for conceptually similar capabilities.