예제 #1
0
파일: XObject.cs 프로젝트: kstubs/ProjFlx
        public XObject(DatabaseQuery Query, string ProjectSqlPath, string ProjectSqlName)
        {
            _query = Query;
            if (Timing == null && Query.Timing != null)
            {
                Timing = Query.Timing;
            }
            _projectSqlName = ProjectSqlName;

            XmlDocument xm = new XmlDocument();

            xm.Load(ProjectSqlPath);

            string  xpath = String.Format("/projectSql/child::node()[local-name()='{0}']", _projectSqlName);
            XmlNode node  = xm.SelectSingleNode(xpath);

            if (node == null)
            {
                throw new ProjectException(new ProjectExceptionArgs("Invalid ProjectSQL Doc",
                                                                    "ProjectFlx.DB.XObject, FLX", "XObject(DatabaseQuery Query, string ProjectSqlPath, string ProjectSqlName)",
                                                                    String.Format("string xpath = String.Format(\"/projectSql/child::node()[local-name()='{0}']\"", _projectSqlName), SeverityLevel.Critical, LogLevel.Event));
            }

            _xmldocument = new XmlDocument();
            _xmldocument.LoadXml("<queries/>");

            foreach (XmlNode query in node.ChildNodes)
            {
                var importnode = _xmldocument.ImportNode(query, true);
                _xmldocument.DocumentElement.AppendChild(importnode);
            }
        }
예제 #2
0
파일: XObject.cs 프로젝트: kstubs/ProjFlx
        public XObject(DatabaseQuery Query, IProject Project)
        {
            _query = Query;
            if (Timing == null && Query.Timing != null)
            {
                Timing = Query.Timing;
            }

            _xmldocument = new XmlDocument();

            string serialized = Project.SchemaQuery.Serialize();
            string xml        = String.Format("<queries>{0}</queries>", Regex.Replace(serialized, @"<\?xml.+?>", ""));

            _xmldocument.LoadXml(xml);
        }