private void initIO(bool reload) { /*Загрузка, Наследование, Доступ*/ if(this._iniDoc == null) { this._iniDoc = this.openIni(this.bioCode); if((this._iniDoc != null) && (this.OwnerSession.Cfg.EnableDocInhirance)) this._iniDoc = this.processInhirits(_iniDoc); } else if(reload) { this._iniDoc.ReopenDocument(); if(this.OwnerSession.Cfg.EnableDocInhirance) this._iniDoc = this.processInhirits(_iniDoc); } XmlNode vStore = this._iniDoc.XmlDoc.DocumentElement; this.processStore((XmlElement)vStore); String vLocIOIniFN = this.OwnerSession.Cfg.LocalIOCfgPath + this.OwnerSession.CurSessionRemoteIP + "-" + this.bioCode + "-" + this.OwnerSession.Cfg.CurUser.Login + ".xml"; if(File.Exists(vLocIOIniFN)) { dom4cs vLocIOIniDoc = dom4cs.OpenDocument(vLocIOIniFN); XmlElement vLocIniSrc = vLocIOIniDoc.XmlDoc.DocumentElement; XmlElement vLocIniDst = this._iniDoc.XmlDoc.CreateElement("local_ini"); this._iniDoc.XmlDoc.DocumentElement.AppendChild(vLocIniDst); dom4cs.CopyAttrs(vLocIniSrc, vLocIniDst); vLocIniDst.InnerXml = vLocIniSrc.InnerXml; XmlNode vSaveToFNNode = vLocIniDst.SelectSingleNode("saveto"); if(vSaveToFNNode == null) { vSaveToFNNode = this._iniDoc.XmlDoc.CreateElement("saveto"); vLocIniDst.AppendChild(vSaveToFNNode); } vSaveToFNNode.InnerText = vLocIOIniFN; } }
public static dom4cs NewDocument(String vRootTag, String vEncoding, String vDTDFileName) { dom4cs newDOM4CS = new dom4cs(); XmlDocument doc = new XmlDocument(); if (vEncoding != null) newDOM4CS.FEncoding = vEncoding; XmlDeclaration xd = doc.CreateXmlDeclaration("1.0", newDOM4CS.FEncoding, null); doc.AppendChild(xd); if (vDTDFileName != null) { XmlDocumentType xdt = doc.CreateDocumentType(vRootTag, null, vDTDFileName, null); doc.AppendChild(xdt); } if (vRootTag != null) { XmlElement rn = doc.CreateElement(vRootTag); doc.AppendChild(rn); } newDOM4CS.XmlDoc = doc; return newDOM4CS; }
protected override void doExecute() { base.doExecute(); EBioException vEx = null; var vDoc = new StringBuilder(); try { var vDS = this.FBioDesc.DocumentElement; if(vDS != null) { if (vDS.SelectSingleNode("SQL[@action='select']") != null) this._loadDocFromCursor(vDS, vDoc, ref vEx); else if (vDS.SelectSingleNode("SQL[@action='execute']") != null) this._loadDocFromProc(vDS, vDoc, ref vEx); } else vEx = new EBioException("В описании объекта [" + this.bioCode + "] не найден раздел <store>."); } finally { if(vEx == null) { var iofn = SrvUtl.bldiniFileName(this.BioSession.Cfg.IniPath, this.bioCode); var xslfn = iofn.ToLower().Replace(".xml", ".xsl"); var cssfn = iofn.ToLower().Replace(".xml", ".css"); if(File.Exists(xslfn)) { var rsltDoc = new dom4cs(); rsltDoc.XmlDoc = dom4cs.CreXmlDocument(vDoc.ToString()); var vElem = rsltDoc.XmlDoc.CreateElement("appurl"); vElem.InnerText = this.BioSession.Cfg.AppURL; rsltDoc.XmlDoc.DocumentElement.AppendChild(vElem); vElem = rsltDoc.XmlDoc.CreateElement("biourl"); vElem.InnerText = SrvUtl.bldIOPathUrl(this.BioSession.Cfg.AppURL, this.bioCode); rsltDoc.XmlDoc.DocumentElement.AppendChild(vElem); rsltDoc.WriteToStream(this.Context.Response.OutputStream, xslfn); } else { this.Context.Response.Write(vDoc.ToString()); } } else { var vAgent = this.BioSession.CurSessionRemoteAgent; if(vAgent.ToUpper().StartsWith("DALPHA")) throw vEx; this.Context.Response.Write(vEx.ToString()); } this.Context.Response.Flush(); } }
private dom4cs processInhirits(dom4cs iniDoc) { dom4cs parentDoc = null; if(iniDoc != null) { String parentDocName = ((XmlElement)iniDoc.XmlDoc.DocumentElement).GetAttribute("extends"); if(!parentDocName.Equals("")) { parentDoc = this.openIni(parentDocName); if(parentDoc != null) { parentDoc.MergeDocument(iniDoc, this.OwnerSession.Cfg.IniPath + SrvConst.csMIFileName); parentDoc = processInhirits(parentDoc); return parentDoc; } else return iniDoc; } else return iniDoc; } else return iniDoc; }
public bool MergeDocument(dom4cs vSrcDoc, String vMergeInsructionFileName){ dom4cs fMI = dom4cs.OpenDocument(vMergeInsructionFileName); this.syncNode(vSrcDoc.XmlDoc.DocumentElement, fMI.XmlDoc); this.FFileName = vSrcDoc.FFileName; this.FEncoding = vSrcDoc.FEncoding; XmlNodeList vForms = this.XmlDoc.DocumentElement.SelectNodes("//form"); for(int i=0; i<vForms.Count; i++){ XmlNodeList vFormTabs = ((XmlElement)vForms[i]).SelectNodes("tabs/tab"); for(int j=0; j<vFormTabs.Count; j++){ BubbleSort(vFormTabs[i], "rows/row", "@id"); } } XmlElement vTools = (XmlElement)this.XmlDoc.DocumentElement.SelectSingleNode("//tools"); //Utils.AppendStringToFile("d:\\mrg_sort_bfr.xml", this.XmlDoc.OuterXml, Encoding.UTF8); BubbleSort(vTools, "tool", "@id"); //Utils.AppendStringToFile("d:\\mrg_sort_aftr.xml", this.XmlDoc.OuterXml, Encoding.UTF8); return true; }
public static dom4cs AssignDocument(String vXML) { dom4cs newTDOM4CS = new dom4cs(); XmlDocument doc = new XmlDocument(); StringReader vInStream = new StringReader(vXML); doc.Load(vInStream); newTDOM4CS.XmlDoc = doc; return newTDOM4CS; }
public static dom4cs OpenDocument(String vFileName) { dom4cs newTDOM4CS = new dom4cs(); XmlDocument doc = new XmlDocument(); doc.Load(vFileName); newTDOM4CS.XmlDoc = doc; newTDOM4CS.FileName = vFileName; return newTDOM4CS; }