XFormsInstance.prototype = new XFormsElement; function XFormsInstance (strParentId, strId, bPreserveWhitespace, strTag, strEncoding, strVersion, strXml) { if (!strId) { return; } XFormsElement.call(this, strParentId, strId, strTag); strXml = this._restore(strXml); /** * Attribute */ this.attribute["preservewhitespace"] = bPreserveWhitespace; /** * Property */ this.preserveWhitespace = bPreserveWhitespace; this.encoding = strEncoding; this.documentElement = XmlLib.loadXMLFromString(strXml); this.root = this.documentElement.firstChild; this.version = strVersion; this.xml = strXml; this.m_docClone; /** * Model에 추가한다. */ XFormsModel.appendInstance(strId, this, strParentId); }; XFormsInstance.prototype.getXml = function () { return this.xml = XmlLib.serializeToString(this.documentElement); }; XFormsInstance.prototype.getAbility = function () { return EA_HAS_DOM; }; /** * 인스턴스 초기화에 관한일을 정의한다. * @return */ XFormsInstance.prototype.synchronize = function () { // documentElement과 xml을 동기화 시킨다. this.xml = XmlLib.serializeToString(this.documentElement); this.root = this.documentElement.firstChild; }; XFormsInstance.prototype.createAttribute = function () { }; XFormsInstance.prototype.createElement = function (strName) { return this.documentElement.createElement(strName); }; XFormsInstance.prototype.createNode = function (strType, strName, strNamespace) { var xnNode = null; if ("element" == strType) { xnNode = this.createElement(strName); } else if ("attribute" == strType) { xnNode = this.createAttribute(strName); } // TODO namespaceURI return xnNode; }; XFormsInstance.prototype.getElementsByTagName = function () { }; XFormsInstance.prototype.getXPathString = function () { }; XFormsInstance.prototype.load = function () { }; XFormsInstance.prototype.loadXML = function (strXml) { this.xml = strXml; this.documentElement = XmlLib.loadXMLFromString(strXml); this.root = this.documentElement.firstChild; }; XFormsInstance.prototype.selectNodes = function (strXPath) { return XmlLib.selectNodes(this.documentElement, strXPath); }; XFormsInstance.prototype.selectNodesXml = function (strXPath) { var strNode = ""; var xnNodeList = XmlLib.selectNodes(this.documentElement, strXPath); if (null != xnNodeList) { for (var i=0; i< xnNodeList.length; i++) { strNode += XmlLib.serializeToString(xnNodeList.item(i)); } } return strNode; }; XFormsInstance.prototype.selectSingleNode = function (strXPath) { return XmlLib.selectSingleNode(this.documentElement, strXPath); }; XFormsInstance.prototype.cloneInstances = function () { }; XFormsInstance.prototype._restore = function (strXml) { strXml = strXml.split("\_\_TF\_N").join("\\n"); strXml = strXml.split("\_\_TF\_T").join("\\t"); strXml = strXml.split("\_\_TF\_R").join("\\r"); return strXml; }; // TODO createChild 구현중 2011. 03. 15. 박현우 ///////////////////////////////////////////////////////////////////////////////////// //XFormsInstance.create = function (strParentId, clAttribute, strStyle) //{ // // 메인노드 생성 // var xnInsatance = XFormsInstance.createMainNode(clAttribute); //// var xnParent = document.getElementById("HE_"+strParentId); //// xnParent.appendChild(xnInsatance); //// //// // 하위노드 생성 //// xnInsatance = XFormsInstance.createSubNodes(xnInsatance, clAttribute); // // // object 생성 // return XFormsInstance.createObject(strParentId, xnInsatance, clAttribute, strStyle); //}; // //XFormsInstance.createMainNode = function (clAttribute) //{ // //// return xnInstance; //}; // //XFormsInstance.createObject = function (strParentId, xnInstance, clAttribute, strStyle) //{ // var strId = ""; // var bPreserveWhiteSpace = false; // var strEncoding = ""; // var strVersion = ""; // var strXml = ""; // var strUserDefineAttrib = ""; // // for (var i=0; i