コード例 #1
0
        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);
        }
コード例 #3
0
 public XmlCache(IServiceProvider site, SchemaCache schemaCache, DelayedActions handler)
 {
     this._loader      = new DomLoader(site);
     this._schemaCache = schemaCache;
     this._site        = site;
     this.Document     = new XmlDocument();
     this._actions     = handler;
     this._settings    = (Settings)this._site.GetService(typeof(Settings));
 }
コード例 #4
0
 public void Clear()
 {
     this._renamed = null;
     _loader       = new DomLoader(this._site);
     this.Document = new XmlDocument();
     StopFileWatch();
     this._fileName = null;
     FireModelChanged(ModelChangeType.Reloaded, this._doc);
 }
コード例 #5
0
 public XmlCache(IServiceProvider site, ISynchronizeInvoke sync)
 {
     this.loader         = new DomLoader(site);
     this.schemaCache    = new SchemaCache(site);
     this.site           = site;
     this.sync           = sync;
     this.Document       = new XmlDocument();
     this.timer.Tick    += new EventHandler(Reload);
     this.timer.Interval = 1000;
     this.timer.Enabled  = false;
 }
コード例 #6
0
        void OnPIChange(XmlNodeChangedEventArgs e)
        {
            XmlProcessingInstruction pi = (XmlProcessingInstruction)e.Node;

            if (pi.Name == "xml-stylesheet")
            {
                if (e.Action == XmlNodeChangedAction.Remove)
                {
                    // see if there's another!
                    pi = (XmlProcessingInstruction)this.doc.SelectSingleNode("processing-instruction('xml-stylesheet')");
                }
                if (pi != null)
                {
                    this.xsltFilename = DomLoader.ParseXsltArgs(pi.Data);
                }
            }
        }
コード例 #7
0
        void OnPIChange(XmlNodeChangedEventArgs e)
        {
            XmlProcessingInstruction pi = (XmlProcessingInstruction)e.Node;

            if (pi.Name == "xml-stylesheet")
            {
                if (e.Action == XmlNodeChangedAction.Remove)
                {
                    // see if there's another!
                    pi = this._doc.SelectSingleNode("processing-instruction('xml-stylesheet')") as XmlProcessingInstruction;
                }
                if (pi != null)
                {
                    this.XsltFileName = DomLoader.ParseXsltArgs(pi.Data);
                }
                else
                {
                    this.XsltFileName = null;
                }
            }
            else if (pi.Name == "xsl-output")
            {
                if (e.Action == XmlNodeChangedAction.Remove)
                {
                    // see if there's another!
                    pi = this._doc.SelectSingleNode("processing-instruction('xsl-output')") as XmlProcessingInstruction;
                }
                if (pi != null)
                {
                    this.XsltDefaultOutput = DomLoader.ParseXsltOutputArgs(pi.Data);
                }
                else
                {
                    this.XsltDefaultOutput = null;
                }
            }
        }
コード例 #8
0
ファイル: XmlCache.cs プロジェクト: Podracer/DAE-notepad
        /// <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);
        }
コード例 #9
0
ファイル: XmlCache.cs プロジェクト: Podracer/DAE-notepad
 public XmlCache(IServiceProvider site, ISynchronizeInvoke sync)
 {
     this.loader = new DomLoader(site);
     this.schemaCache = new SchemaCache(site);
     this.site = site;
     this.sync = sync;
     this.Document = new XmlDocument();
     this.timer.Tick += new EventHandler(Reload);
     this.timer.Interval = 1000;
     this.timer.Enabled = false;
 }