public void Load(XmlReader reader, string fileName)
        {
            this.Clear();
            loader = new DomLoader(this.site);
            StopFileWatch();

            Uri uri = new Uri(fileName, UriKind.RelativeOrAbsolute);

            if (!uri.IsAbsoluteUri)
            {
                Uri resolved = new Uri(new Uri(Directory.GetCurrentDirectory() + "\\"), uri);
                fileName = resolved.LocalPath;
                uri      = resolved;
            }

            this.filename     = fileName;
            this.lastModified = this.LastModTime;
            this.dirty        = false;
            StartFileWatch();

            this.Document     = loader.Load(reader);
            this.xsltFilename = this.loader.XsltFileName;

            // calling this event will cause the XmlTreeView to populate
            FireModelChanged(ModelChangeType.Reloaded, this.doc);
        }
示例#2
0
        /// <summary>
        /// Loads an instance of xml.
        /// Load updated to handle validation when instance doc refers to schema.
        /// </summary>
        /// <param name="file">Xml instance document</param>
        /// <returns></returns>
        public void Load(string file)
        {
            this.Clear();
            loader = new DomLoader(this.site);
            StopFileWatch();

            Uri uri = new Uri(file, UriKind.RelativeOrAbsolute);

            if (!uri.IsAbsoluteUri)
            {
                Uri resolved = new Uri(new Uri(Directory.GetCurrentDirectory() + "/"), uri);
                file = resolved.LocalPath;
            }

            this.filename     = file;
            this.lastModified = this.LastModTime;
            this.dirty        = false;
            StartFileWatch();

            XmlReaderSettings settings = GetReaderSettings();

            settings.ValidationEventHandler += new ValidationEventHandler(OnValidationEvent);
            using (XmlReader reader = XmlReader.Create(file, settings)) {
                this.Document = loader.Load(reader);
            }
            this.xsltFilename = this.loader.XsltFileName;

            // calling this event will cause the XmlTreeView to populate
            FireModelChanged(ModelChangeType.Reloaded, this.doc);
        }
        public void ExpandIncludes()
        {
            if (this.Document != null)
            {
                this.dirty = true;
                XmlReaderSettings s = new XmlReaderSettings();
                s.DtdProcessing = GetSettingBoolean("IgnoreDTD") ? DtdProcessing.Ignore : DtdProcessing.Parse;
                s.XmlResolver   = new XmlProxyResolver(this.site);
                using (XmlReader r = XmlIncludeReader.CreateIncludeReader(this.Document, s, this.FileName)) {
                    this.Document = loader.Load(r);
                }

                // calling this event will cause the XmlTreeView to populate
                FireModelChanged(ModelChangeType.Reloaded, this.doc);
            }
        }
示例#4
0
        /// <summary>
        /// Loads an instance of xml.
        /// Load updated to handle validation when instance doc refers to schema.
        /// </summary>
        /// <param name="file">Xml instance document</param>
        /// <returns></returns>
        public void Load(string file)
        {
            this.Clear();
            loader = new DomLoader(this.site);
            StopFileWatch();

            Uri uri = new Uri(file, UriKind.RelativeOrAbsolute);
            if (!uri.IsAbsoluteUri) {
                Uri resolved = new Uri(new Uri(Directory.GetCurrentDirectory() + "\\"), uri);
                file = resolved.LocalPath;
            }

            this.filename = file;
            this.lastModified = this.LastModTime;
            this.dirty = false;
            StartFileWatch();

            XmlReaderSettings settings = GetReaderSettings();
            settings.ValidationEventHandler += new ValidationEventHandler(OnValidationEvent);
            using (XmlReader reader = XmlReader.Create(file, settings)) {
                this.Document = loader.Load(reader);
            }
            this.xsltFilename = this.loader.XsltFileName;

            // calling this event will cause the XmlTreeView to populate
            FireModelChanged(ModelChangeType.Reloaded, this.doc);
        }