123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- 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<clAttribute.count(); i++)
- // {
- // var strAttributeName = clAttribute.keys()[i];
- // switch (strAttributeName)
- // {
- // case "id" :
- // {
- // strId = clAttribute.item(strAttributeName);
- // break;
- // }
- // case "preservewhitespace" :
- // {
- // if ("true" == clAttribute.item(strAttributeName))
- // {
- // bPreserveWhiteSpace = true;
- // }
- // break;
- // }
- // case "encoding" :
- // {
- // strEncoding = clAttribute.item(strAttributeName);
- // break;
- // }
- // case "id" :
- // {
- // break;
- // }
- // case "version" :
- // {
- // strVersion = clAttribute.item(strAttributeName);
- // break;
- // }
- // case "xml" :
- // {
- // strXml = clAttribute.item(strAttributeName);
- // break;
- // }
- // }
- // }
- // var xnInstance = new XFormsInstance(strParentId, strId, bPreserveWhiteSpace, "xforms:instance", strEncoding, strVersion, strXml, strUserDefineAttrib);
- // return xnInstance;
- //};
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|