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); }
/// <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 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)); }
public void Clear() { this._renamed = null; _loader = new DomLoader(this._site); this.Document = new XmlDocument(); StopFileWatch(); this._fileName = null; FireModelChanged(ModelChangeType.Reloaded, this._doc); }
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; }
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); } } }
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; } } }
/// <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); }