/// <summary> /// Parse the data from specified Uri into a document. /// </summary> /// <param name="document">The document instance to store the gained data in.</param> /// <param name="xmlTextReader">XmlTextReader instance</param> protected virtual void Parse(OpmlDocument document, System.Xml.XmlReader xmlTextReader) { try { System.Diagnostics.Debug.Assert(xmlTextReader != null); // xmlTextReader.MoveToContent(); if (xmlTextReader.Name != "opml") { throw new FormatException(xmlTextReader.BaseURI + " is no valid Opml File"); } // read the stream forward while not end of file int currentDepth = -1; System.Collections.Hashtable nodeLevels = new System.Collections.Hashtable(); // while (!xmlTextReader.EOF) { // process head if (xmlTextReader.Name == "head" && xmlTextReader.NodeType == XmlNodeType.Element) { document.Head = new OpmlHead(xmlTextReader); } // process outline and child outlines else if (xmlTextReader.Name == "outline" && xmlTextReader.NodeType == XmlNodeType.Element) { currentDepth = xmlTextReader.Depth; // OpmlOutline o = OnCreateOutline(xmlTextReader); if (currentDepth == 2) { document.Body.Items.Add(o); // new node nodeLevels.Clear(); } else { ((OpmlOutline)nodeLevels[xmlTextReader.Depth - 1]).Items.Add(o); } nodeLevels[xmlTextReader.Depth] = o; } else { xmlTextReader.Read(); xmlTextReader.MoveToContent(); } } } finally { if (xmlTextReader != null) { xmlTextReader.Close(); } } }
private void DetachItem(OpmlOutline item) { System.Diagnostics.Debug.Assert(item != null); // if (_body != null) { item.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(_body.OnSubItemPropertyChanged); } else { item.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(_outline.OnSubItemPropertyChanged); } item.SetDocument(null); item.SetParent(null); // SetDirtyState(); }
/// <summary>Removes an item to the OpmlOutlineCollection.</summary> public void Remove(OpmlOutline value) { base.List.Remove(value as object); }
/// <summary>Adds an item to the IOpmlOutlineCollection.</summary> public int Add(OpmlOutline value) { return(base.List.Add(value as object)); }
/// <summary>Initializes a new instance of OpmlOutlineCollection</summary> public OpmlOutlineCollection(OpmlOutline outline) { _outline = outline; }
/// <summary>Sets the outline that this outline is assigned to.</summary> internal void SetParent(OpmlOutline value) { this._outline = value; }
/// <summary>Determines whether the OpmlOutlineCollection contains a specific value.</summary> public bool Contains (OpmlOutline value) { return base.List.Contains(value as object); }
private void AttachItem(OpmlOutline item) { Debug.Assert(item != null); if (_body != null) { item.SetDocument(_document); item.SetParent(null); item.PropertyChanged += new PropertyChangedEventHandler(_body.OnSubItemPropertyChanged); } else { item.SetParent(_outline); item.SetDocument(_outline.Document); item.PropertyChanged += new PropertyChangedEventHandler(_outline.OnSubItemPropertyChanged); } SetDirtyState(); }
/// <summary>Removes an item to the OpmlOutlineCollection.</summary> public void Remove (OpmlOutline value) { base.List.Remove(value as object); }
/// <summary>Adds an item to the IOpmlOutlineCollection.</summary> public int Add (OpmlOutline value) { return base.List.Add(value as object); }
/// <summary>Initializes a new instance of OpmlOutlineCollection</summary> public OpmlOutlineCollection (OpmlOutline outline) { _outline = outline; }
/// <summary>Sets the outline that this outline is assigned to.</summary> internal void SetParent (OpmlOutline value) { this._outline = value; }
private void DetachItem (OpmlOutline item) { System.Diagnostics.Debug.Assert(item!=null); // if(_body!=null) { item.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(_body.OnSubItemPropertyChanged); } else { item.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(_outline.OnSubItemPropertyChanged); } item.SetDocument(null); item.SetParent(null); // SetDirtyState(); }
private void DetachItem(OpmlOutline item) { Debug.Assert(item != null); if (_body != null) item.PropertyChanged -= new PropertyChangedEventHandler(_body.OnSubItemPropertyChanged); else item.PropertyChanged -= new PropertyChangedEventHandler(_outline.OnSubItemPropertyChanged); item.SetDocument(null); item.SetParent(null); SetDirtyState(); }
/// <summary>Inserts an IOpmlOutline to the OpmlOutlineCollection at the specified position.</summary> public void Insert(int index, OpmlOutline value) { base.List.Insert(index, value as object); }
/// <summary>Determines whether the OpmlOutlineCollection contains a specific value.</summary> public bool Contains(OpmlOutline value) { return(base.List.Contains(value as object)); }
/// <summary>Inserts an IOpmlOutline to the OpmlOutlineCollection at the specified position.</summary> public void Insert (int index, OpmlOutline value) { base.List.Insert(index, value as object); }