1 /**
  2  * @fileoverview Class implements data instance component for 
  3  * the model-view-controller.
  4  */
  5 
  6 goog.provide('xrx.instance');
  7 
  8 
  9 goog.require('goog.dom');
 10 goog.require('xrx.model');
 11 goog.require('xrx.node');
 12 goog.require('xrx.pilot');
 13 
 14 
 15 /**
 16  * @constructor
 17  */
 18 xrx.instance = function(element) {
 19   goog.base(this, element);
 20 
 21 
 22 
 23   this.xml_ = goog.dom.getRawTextContent(this.getElement());
 24   goog.dom.setTextContent(this.getElement(), '');
 25 };
 26 goog.inherits(xrx.instance, xrx.model);
 27 
 28 
 29 
 30 /**
 31  * @override
 32  */
 33 xrx.instance.prototype.recalculate = function() {};
 34 
 35 
 36 
 37 /**
 38  * @return {!string} The XML document.
 39  */
 40 xrx.instance.prototype.xml = function(xml) {
 41   if (xml) this.xml_ = xml;
 42   return this.xml_;
 43 };
 44 
 45 
 46 
 47 /**
 48  * @return {!xrx.node.Document} The XML document.
 49  */
 50 xrx.instance.prototype.document = function(id) {
 51   var pilot = new xrx.pilot(this.xml());
 52   var node = new xrx.node.Document(pilot, this.getId());
 53   
 54   return node;
 55 };
 56 
 57